aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gmap_arcgis.js39
1 files changed, 35 insertions, 4 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 14c7bdf..1ecf56e 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -64,9 +64,10 @@ function gmapArcgis(config) {
params.service = new gmaps.ags.MapService(params['uri']);
params.overlay = new gmaps.ags.MapOverlay(params.service, {
exportOptions: {
- layerIds: params['layers'],
- layerOption: 'show',
- }
+ layerIds: params['layers'],
+ layerOption: 'show',
+ layerDefinitions: (params['layerDefinitions'] != undefined) ? params['layerDefinitions'] : { },
+ },
});
params.overlay.setMap(this.map);
@@ -89,6 +90,29 @@ 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
@@ -433,7 +457,8 @@ function gmapArcgis(config) {
},
// Center and zoom map to fit the polygon resulting from a query
- fitToBoundsOfQuery: function(params) {
+ // Optinally show the resulting polygon.
+ fitToBoundsOfQuery: function(params, show) {
var self = this;
var layer = new gmaps.ags.Layer(params.uri);
var query = {
@@ -452,6 +477,12 @@ function gmapArcgis(config) {
self.map.setZoom(zoom);
self.map.setCenter(center);
+
+ if (show == true) {
+ feature.geometry[0].setMap(self.map);
+ }
+
+ params.overlay = feature.geometry[0];
});
},
}