aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-OpenLayers.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js/map-OpenLayers.js')
-rw-r--r--web/js/map-OpenLayers.js42
1 files changed, 23 insertions, 19 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index d98994d84..4c96e771c 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -70,26 +70,30 @@ function fms_markers_list(pins, transform) {
}
function fixmystreet_onload() {
- if ( fixmystreet.area ) {
- var area = new OpenLayers.Layer.Vector("KML", {
- strategies: [ new OpenLayers.Strategy.Fixed() ],
- protocol: new OpenLayers.Protocol.HTTP({
- url: "/mapit/area/" + fixmystreet.area + ".kml?simplify_tolerance=0.0001",
- format: new OpenLayers.Format.KML()
- })
- });
- fixmystreet.map.addLayer(area);
- area.events.register('loadend', null, function(a,b,c) {
- var bounds = area.getDataExtent();
- if (bounds) {
- var center = bounds.getCenterLonLat();
- var z = fixmystreet.map.getZoomForExtent(bounds);
- if ( z < 13 && $('html').hasClass('mobile') ) {
- z = 13;
- }
- fixmystreet.map.setCenter(center, z, false, true);
+ if ( fixmystreet.area.length ) {
+ for (var i=0; i<fixmystreet.area.length; i++) {
+ var area = new OpenLayers.Layer.Vector("KML", {
+ strategies: [ new OpenLayers.Strategy.Fixed() ],
+ protocol: new OpenLayers.Protocol.HTTP({
+ url: "/mapit/area/" + fixmystreet.area[i] + ".kml?simplify_tolerance=0.0001",
+ format: new OpenLayers.Format.KML()
+ })
+ });
+ fixmystreet.map.addLayer(area);
+ if ( fixmystreet.area.length == 1 ) {
+ area.events.register('loadend', null, function(a,b,c) {
+ var bounds = area.getDataExtent();
+ if (bounds) {
+ var center = bounds.getCenterLonLat();
+ var z = fixmystreet.map.getZoomForExtent(bounds);
+ if ( z < 13 && $('html').hasClass('mobile') ) {
+ z = 13;
+ }
+ fixmystreet.map.setCenter(center, z, false, true);
+ }
+ });
}
- });
+ }
}
var pin_layer_style_map = new OpenLayers.StyleMap({