aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2014-06-18 17:01:56 -0300
committerSilvio <silvio@socioambiental.org>2014-06-18 17:01:56 -0300
commitec51720696e16d3b9c3286b9fc3522ece39277e0 (patch)
treea5cf3d277b17e363efce1d9541a1cc66e5e265d5
parentb0223a630fdd55c8cc4cfd6557e4b3ad023b2b63 (diff)
downloadgmap_arcgis_js-ec51720696e16d3b9c3286b9fc3522ece39277e0.tar.gz
gmap_arcgis_js-ec51720696e16d3b9c3286b9fc3522ece39277e0.tar.bz2
Adding showPolygonFromQueryMultiple()
-rw-r--r--gmap_arcgis.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index abdbb64..054c8c7 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -607,6 +607,39 @@ function gmapArcgis(config) {
});
},
+ // Show a polygon resulting from the given query in multiple layers
+ showPolygonFromQueryMultiple: function (params, name, layers) {
+ var self = this;
+ var max = 2;
+ var where = params.where;
+
+ // Format where clause for ajax request
+ where = where.replace(/=/g, '%3D');
+ where = where.replace(/ /g, '+');
+
+ // First find out in which layers there are results
+ for (var n in layers) {
+ var layer = n;
+ var args = jQuery.extend(true, {}, params);
+ var url = URL_ARCGIS_TIS + '/' + layer + '/query?where=' + where + '&f=pjson';
+
+ // A closure here keeps the right layer to the async response
+ (function(layer, args) {
+ $.ajax({
+ type: 'get',
+ url: url,
+ dataType: 'jsonp',
+ success: function (response) {
+ if (response.features != undefined && response.features.length != '0') {
+ args.uri += '/' + layer;
+ self.showPolygonFromQuery(args, name);
+ }
+ }
+ });
+ })(layer, args);
+ }
+ },
+
// Close all registered infoWindows
closeInfoWindows: function() {
overlays = [ 'layers', 'markers' ];