Project

General

Profile

« Previous | Next » 

Revision 3085

Added by perry about 18 years ago

Beta version of openalayers wms interface

View differences:

lib/style/common/spatial_templates/openlayers1/controls.html
1
<html xmlns="http://www.w3.org/1999/xhtml">
2
  <head>
3
    <style type="text/css">
4
        body { background-color:black; }
5
        #map {
6
            width: 800px;
7
            height: 400px;
8
            border: 1px solid #cccccc;
9
        }
10
    </style>
11
    <script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script>
12

  
13
    <script src="../../../../spatial/openlayers/lib/OpenLayers.js"></script>
14
    <script type="text/javascript">
15
        <!--
16
        function init(){
17
            var map = new OpenLayers.Map('map', { controls: [] });
18

  
19
            var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
20
                "http://labs.metacarta.com/wms/vmap0",
21
                {layers: 'basic'} );
22

  
23
            var jpl_wms = new OpenLayers.Layer.WMS( "NASA Landsat Mosaic",
24
                "http://wms.jpl.nasa.gov/wms.cgi", 
25
                {layers: "modis,global_mosaic"});
26

  
27
            var metacat_wms = new OpenLayers.Layer.WMS( "Metacat Documents",
28
                "../../../../wms",
29
                {layers: "data_bounds,data_points",
30
                 transparent: "true", format: "image/png"} );
31

  
32
            velayer = new OpenLayers.Layer.VirtualEarth( "MS Virtual Earth",
33
            { minZoomLevel: 1, maxZoomLevel: 20 });
34

  
35
            var demis = new OpenLayers.Layer.WMS( "Demis World Map",
36
                "http://www2.demis.nl/WMS/wms.asp?wms=WorldMap",
37
                {layers: 'Bathymetry,Countries,Topography,Hillshading,Coastlines,Waterbodies,Inundated,Rivers,Streams,Builtup+areas,Railroads,Highways,Roads,Trails,Borders,Cities,Settlements,Airports'} );
38

  
39
            jpl_wms.setVisibility(false);
40
            velayer.setVisibility(false);
41
            ol_wms.setVisibility(false);
42

  
43
            map.addLayers([ol_wms, jpl_wms, metacat_wms, velayer, demis]);
44
            map.addControl(new OpenLayers.Control.PanZoomBar());
45
            map.addControl(new OpenLayers.Control.MouseToolbar());
46
            map.addControl(new OpenLayers.Control.LayerSwitcher());
47
            //map.addControl(new OpenLayers.Control.Permalink());
48
            //map.addControl(new OpenLayers.Control.Permalink($('permalink')));
49
            if (!map.getCenter()) map.zoomToMaxExtent();
50
        }
51
        // -->
52
    </script>
53
  </head>
54
  <body onload="init()">
55
    <!-- <a style="float:right" href="" id="permalink">Permalink</a> -->
56
    <div id="map"></div>
57
  </body>
58
</html>
59 0

  
lib/style/common/spatial_templates/openlayers1/ve.html
1
<html xmlns="http://www.w3.org/1999/xhtml">
2
  <head>
3
    <meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
4
    <style type="text/css">
5
        #map {
6
            width: 100%;
7
            height: 512px;
8
            border: 1px solid black;
9
        }
10
    </style>
11

  
12

  
13
    <script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script>
14

  
15
    <script src="../lib/OpenLayers.js"></script>
16
    <script type="text/javascript">
17
        <!--
18
 
19
        var lon = 5;
20
        var lat = 40;
21
        var zoom = 15;
22
        var map, velayer, layer;
23

  
24
        function init(){
25
            map = new OpenLayers.Map( $('map') , 
26
            {controls:[new OpenLayers.Control.MouseDefaults()]});
27

  
28
            velayer = new OpenLayers.Layer.VirtualEarth( "VE",
29
            { minZoomLevel: 4, maxZoomLevel: 6 }); 
30
            map.addLayer(velayer);
31
            
32
            markers = new OpenLayers.Layer.Markers("markers");
33
            map.addLayer(markers);
34

  
35
            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
36
            map.addControl( new OpenLayers.Control.LayerSwitcher() );
37
            map.addControl( new OpenLayers.Control.PanZoomBar() );
38
        }
39
        
40
        function add() {
41
            
42
            marker = new OpenLayers.Marker(new OpenLayers.LonLat(2, 41));
43
            markers.addMarker(marker);
44
        }
45

  
46
        function remove() {
47
            markers.removeMarker(marker);
48
        }
49
  // -->
50
    </script>
51
  </head>
52
  <body onload="init()">
53
    <h1>OpenLayers VE Example</h1>
54
    <div id="map"></div>
55
    <div style="background-color:green" onclick="add()"> click to add the marker to the map</div>
56
    <div style="background-color:red" onclick="remove()"> click to remove the marker from the map</div>
57
  </body>
58
</html>
59 0

  
lib/style/common/spatial_templates/openlayers1/click.html
1
<html xmlns="http://www.w3.org/1999/xhtml">
2
  <head>
3
    <style type="text/css">
4
        #map {
5
            width: 512px;
6
            height: 512px;
7
            border: 1px solid black;
8
        }
9
    </style>
10
    <script src="../lib/OpenLayers.js"></script>
11
    <script type="text/javascript">
12
        <!--
13
        function init(){
14
            var map = new OpenLayers.Map('map');
15

  
16
            var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
17
                "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
18

  
19
            var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
20
                "http://wms.jpl.nasa.gov/wms.cgi", 
21
                {layers: "modis,global_mosaic"});
22

  
23
            jpl_wms.setVisibility(false);
24

  
25
            map.addLayers([ol_wms, jpl_wms]);
26
            map.addControl(new OpenLayers.Control.LayerSwitcher());
27
            // map.setCenter(new OpenLayers.LonLat(0, 0), 0);
28
            map.zoomToMaxExtent();
29
            map.events.register("click", map, function(e) { 
30
                var lonlat = map.getLonLatFromViewPortPx(e.xy);
31
                alert("You clicked near " + lonlat.lat + " N, " +
32
                                          + lonlat.lon + " E");
33
            });
34
        }
35
        // -->
36
    </script>
37
  </head>
38
  <body onload="init()">
39
    <h1>OpenLayers Example</h1>
40
    <div id="map"></div>
41
  </body>
42
</html>
43 0

  
lib/style/common/spatial_templates/openlayers1/map.html
1
<html xmlns="http://www.w3.org/1999/xhtml">
2
  <head>
3
    <style type="text/css">
4
        body { background-color:white; }
5
        #map {
6
            width: 760px;
7
            height: 380px;
8
            border: 1px solid #cccccc;
9
        }
10
    </style>
11
    <!-- <script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script> -->
12

  
13
    <!-- <script src="../../../../spatial/openlayers/lib/OpenLayers.js"></script> -->
14
    <script src="http://openlayers.org/api/2.1/OpenLayers.js"></script>
15
    <script type="text/javascript">
16
        <!--
17
function round(number,decplaces) {
18
  var multiplier = '1';
19
  for (i=0; i < decplaces; i++ ) {
20
    multiplier = multiplier + '0';
21
  }
22
  var rounded = Math.round(number * parseFloat(multiplier)) / parseFloat(multiplier);
23
  return rounded;
24

  
25
}
26

  
27
        function init(){
28
            var bounds = new OpenLayers.Bounds(-180,-90,180,90);
29
            var map = new OpenLayers.Map('map', { controls: [], 'maxExtent':bounds, 'maxResolution':'auto'});
30
            //var map = new OpenLayers.Map('map', { controls: [] });
31

  
32
            var metacat_points = new OpenLayers.Layer.WMS( "Metacat Doc Points",
33
                "../../../../wms",
34
                {layers: "data_points",
35
                 transparent: "true", format: "image/gif"} );
36

  
37
            var metacat_bounds = new OpenLayers.Layer.WMS( "Metacat Doc Bounds",
38
                "../../../../wms",
39
                {layers: "data_bounds",
40
                 transparent: "true", format: "image/gif"} );
41

  
42
            var world_borders = new OpenLayers.Layer.WMS( "World Borders",
43
                "../../../../wms",
44
                {layers: "world_borders",
45
                 format: "image/jpeg"} );
46

  
47
            /* 
48
             *   Other possible WMS base layers to include
49
             */
50

  
51
            var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
52
                "http://labs.metacarta.com/wms/vmap0",
53
                {layers: 'basic'} );
54

  
55
            var jpl_wms = new OpenLayers.Layer.WMS( "NASA Landsat Mosaic",
56
                "http://wms.jpl.nasa.gov/wms.cgi", 
57
                {layers: "modis,global_mosaic"});
58

  
59
            var demis = new OpenLayers.Layer.WMS( "Demis World Map",
60
                "http://www2.demis.nl/WMS/wms.asp?wms=WorldMap",
61
                {layers: 'Bathymetry,Countries,Topography,Hillshading,Coastlines,Waterbodies,Inundated,Rivers,Streams,Builtup+areas,Railroads,Highways,Roads,Trails,Borders,Cities,Settlements,Airports'} );
62

  
63
            jpl_wms.setVisibility(false);
64
            ol_wms.setVisibility(false);
65
            demis.setVisibility(false);
66

  
67

  
68
            map.addLayers([world_borders,jpl_wms, ol_wms, demis, metacat_points, metacat_bounds]);
69
            map.addControl(new OpenLayers.Control.PanZoomBar());
70
            //map.addControl(new OpenLayers.Control.MouseToolbar());
71
            map.addControl(new OpenLayers.Control.LayerSwitcher());
72
            //map.addControl(new OpenLayers.Control.Permalink());
73
            //map.addControl(new OpenLayers.Control.Permalink($('permalink')));
74
            if (!map.getCenter()) map.zoomToMaxExtent();
75

  
76
map.events.register('click', map, function (e) {
77
    var tolerance = new OpenLayers.Pixel(3, 3);
78
    var min_px = new OpenLayers.Pixel( e.xy.x - tolerance.x, e.xy.y + tolerance.y);
79
    var max_px = new OpenLayers.Pixel( e.xy.x + tolerance.x, e.xy.y - tolerance.y);
80
    var mid_px = new OpenLayers.Pixel( e.xy.x , e.xy.y );
81
    var min_ll = map.getLonLatFromPixel(min_px);
82
    var max_ll = map.getLonLatFromPixel(max_px);
83
    var mid_ll = map.getLonLatFromPixel(mid_px);
84
    //alert("longitude:&nbsp; " + round(mid_ll.lon,3) + " , latitude:&nbsp; " + round(mid_ll.lat,3) );
85
    url = '../../../../metacat?action=spatial_query&xmin='+min_ll.lon+'&ymin='+min_ll.lat+'&xmax='+max_ll.lon+'&ymax='+max_ll.lat+'&skin=default';
86
    OpenLayers.ProxyHost = '';
87
    newwindow = window.open(url,'queryWin',
88
                  'height=600,width=800,status=yes,toolbar=yes,menubar=no,location=yes,resizable=yes,scrollbars=yes');
89

  
90
});
91

  
92
        }
93
        // -->
94
    </script>
95
  </head>
96
  <body onload="init()">
97
    <!-- <a style="float:right" href="" id="permalink">Permalink</a> -->
98
    <div id="map"></div>
99
  </body>
100
</html>
0 101

  

Also available in: Unified diff