aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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' ];