From b0582e5bc9d733ac3c4738e73b5efd433d61cca1 Mon Sep 17 00:00:00 2001 From: Silvio Date: Tue, 23 Apr 2013 15:39:00 -0300 Subject: Process more than one result at showPolygonFromQuery() --- gmap_arcgis.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/gmap_arcgis.js b/gmap_arcgis.js index ededb2d..b1b2cff 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -477,21 +477,25 @@ function gmapArcgis(config) { layer.query(query, function(fset) { var fs = fset.features; - var feature = fs[0]; - params.overlay = feature.geometry[0]; + params.overlay = []; - // Fit map to polygon bounds - if (params.fitBounds != undefined && params.fitBounds == true) { - var bounds = params.overlay.getBounds(); - var zoom = self.getZoomByBounds(bounds); - var center = bounds.getCenter(); + for (i in fs) { + var feature = fs[i]; + params.overlay[i] = feature.geometry[0]; - self.map.setZoom(zoom); - self.map.setCenter(center); - } + // Fit map to polygon bounds + if (params.fitBounds != undefined && params.fitBounds == true) { + var bounds = params.overlay[i].getBounds(); + var zoom = self.getZoomByBounds(bounds); + var center = bounds.getCenter(); + + self.map.setZoom(zoom); + self.map.setCenter(center); + } - // Show polygon - params.overlay.setMap(self.map); + // Show polygon + params.overlay[i].setMap(self.map); + } return params.overlay; }); -- cgit v1.2.3