aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-04-23 15:39:00 -0300
committerSilvio <silvio@socioambiental.org>2013-04-23 15:39:00 -0300
commitb0582e5bc9d733ac3c4738e73b5efd433d61cca1 (patch)
treeeef2dca881255847b1d397559c2500edbca9db93
parentca61110b30065c5b1902eab52c2cc027107a84b4 (diff)
downloadgmap_arcgis_js-b0582e5bc9d733ac3c4738e73b5efd433d61cca1.tar.gz
gmap_arcgis_js-b0582e5bc9d733ac3c4738e73b5efd433d61cca1.tar.bz2
Process more than one result at showPolygonFromQuery()
-rw-r--r--gmap_arcgis.js28
1 files 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;
});