Project

General

Profile

« Previous | Next » 

Revision 5856

include standard list of named locations - zoom map to that location when selected

View differences:

map.jsp
50 50

  
51 51
        // for turning on and off the spatial search control
52 52
		var control;
53
        var map;
53 54
        
54 55
		function round(number,decplaces) {
55 56
		  var multiplier = '1';
......
63 64

  
64 65
        function init(){
65 66
            var bounds = new OpenLayers.Bounds(-180,-90,180,90);
66
            var map = new OpenLayers.Map('map', { 'maxExtent':bounds, 'maxResolution':'auto'});
67
            map = new OpenLayers.Map('map', { 'maxExtent':bounds, 'maxResolution':'auto'});
67 68
            //var map = new OpenLayers.Map('map', { controls: [] });
68 69

  
69 70
            var metacat_points = new OpenLayers.Layer.WMS( "Metacat Doc Points",
......
164 165
            }
165 166

  
166 167
        }
168
        
169
        // for named location navigation
170
        function zoomToLocation(locations) {
171
			var selectedLocation = locations.options[locations.selectedIndex].value;
172
			// add a comma for the rectangle
173
			selectedLocation = selectedLocation.replace(" ", ",")
174
			var bounds = OpenLayers.Bounds.fromString(selectedLocation);
175
            map.zoomToExtent(bounds);
176
        }
167 177
        // -->
168 178
    </script>
169 179
  </head>
170 180
  <body onload="init()">
171 181
    <!-- <a style="float:right" href="" id="permalink">Permalink</a> -->
172 182
    <div id="map"></div>
183
	<div id="featureList">
184
		<form>
185
			<select id="locations" onchange="zoomToLocation(this)">
186
				<%@ include file="locations.jsp"%>
187
			</select>
188
		</form>
189
	</div>
173 190
  </body>
174 191
</html>

Also available in: Unified diff