aboutsummaryrefslogtreecommitdiff
path: root/gmap_arcgis.js
diff options
context:
space:
mode:
Diffstat (limited to 'gmap_arcgis.js')
-rw-r--r--gmap_arcgis.js49
1 files changed, 15 insertions, 34 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 5689e6b..5b7bf69 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -90,29 +90,6 @@ function gmapArcgis(config) {
return params.overlay;
},
- // TODO: merge with fitToBoundsOfQuery
- // Add polygons from a custom query
- showPolygonFromQuery: function(params) {
- var self = this;
- var layer = new gmaps.ags.Layer(params.uri);
- var query = {
- returnGeometry: true,
- geometryType: 'esriGeometryPolygon',
- where: params.where,
- outFields: '*',
- };
-
- layer.query(query, function(fset) {
- var fs = fset.features;
- var feature = fs[0];
- params.overlay = feature.geometry[0];
-
- params.overlay.setMap(self.map);
- });
-
- return params.overlay;
- },
-
// Add an identify callback to a layer
identifyPolygon: function(params) {
// See https://google-maps-utility-library-v3.googlecode.com/svn/trunk/arcgislink/examples/identify.js
@@ -457,7 +434,7 @@ function gmapArcgis(config) {
// Center and zoom map to fit the polygon resulting from a query
// Optinally show the resulting polygon.
- fitToBoundsOfQuery: function(params, show) {
+ showPolygonFromQuery: function(params) {
var self = this;
var layer = new gmaps.ags.Layer(params.uri);
var query = {
@@ -468,20 +445,24 @@ function gmapArcgis(config) {
};
layer.query(query, function(fset) {
- var fs = fset.features;
- var feature = fs[0];
- var bounds = feature.geometry[0].getBounds();
- var zoom = self.getZoomByBounds(bounds);
- var center = bounds.getCenter();
+ var fs = fset.features;
+ var feature = fs[0];
+ params.overlay = 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.getBounds();
+ var zoom = self.getZoomByBounds(bounds);
+ var center = bounds.getCenter();
- if (show == true) {
- feature.geometry[0].setMap(self.map);
+ self.map.setZoom(zoom);
+ self.map.setCenter(center);
}
- params.overlay = feature.geometry[0];
+ // Show polygon
+ params.overlay.setMap(self.map);
+
+ return params.overlay;
});
},
}