aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-04-09 16:51:57 -0300
committerSilvio <silvio@socioambiental.org>2013-04-09 16:51:57 -0300
commitd53c62bf7d4839d456eeb21fede184688fec2160 (patch)
tree581bfa7f1a9ae8b31111939adf507339461bd0b4
parentb02d62ff65c4c52c763d24bbddde2342dceee223 (diff)
downloadgmap_arcgis_js-d53c62bf7d4839d456eeb21fede184688fec2160.tar.gz
gmap_arcgis_js-d53c62bf7d4839d456eeb21fede184688fec2160.tar.bz2
Adding showPolygonFromQuery method and layerDefinitions to showPolygon
-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];
});
},
}