- var osm_layer = new OpenLayers.Layer.GML("OSM", url, {
- format: OpenLayers.Format.OSM,
- projection: new OpenLayers.Projection("EPSG:4326")
- });
-
- osm_layer.events.register("loadend", osm_layer, function() {
- if (this.features.length) {
- var extent = this.features[0].geometry.getBounds();
- for (var i = 1; i < this.features.length; i++) {
- extent.extend(this.features[i].geometry.getBounds());
- }
-
- <% unless lat_lon_zoom_via_params %>
- if (extent) {
- this.map.zoomToExtent(extent);
- } else {
- this.map.zoomToMaxExtent();
- }
- <% else %>
- var center = new OpenLayers.LonLat(<%= lon %>, <%= lat %>);
- var zoom = <%= zoom %>;
- <% end %>
-
- var center = getMapCenter();
- }
- });
-
- map.addLayer(osm_layer);
- osm_layer.loadGML();
- osm_layer.loaded = true;
-
- <% else %>
- var centre = new OpenLayers.LonLat(<%= lon %>, <%= lat %>);
- var zoom = <%= zoom %>;
-
- <% if params['scale'] and params['scale'].length > 0 then %>
- zoom = scaleToZoom(<%= params['scale'].to_f() %>);
- <% end %>
-
- setMapCenter(centre, zoom);
+ <% if params['scale'] and params['scale'].length > 0 then %>
+ zoom = scaleToZoom(<%= params['scale'].to_f() %>);
+ <% end %>
+
+ setMapCenter(centre, zoom);
+ <% end %>
+
+ updateLocation();