diff options
author | Silvio <silvio@socioambiental.org> | 2013-04-01 19:39:56 -0300 |
---|---|---|
committer | Silvio <silvio@socioambiental.org> | 2013-04-01 19:39:56 -0300 |
commit | f873a1d5a193f98659235708777e1acc64a4b03c (patch) | |
tree | 441b3046ed91bba2f97df51be24b53c25c05045c | |
parent | ef525f578389fde715d4f999fe27b0b6aa9d2eb2 (diff) | |
download | gmap_arcgis_js-f873a1d5a193f98659235708777e1acc64a4b03c.tar.gz gmap_arcgis_js-f873a1d5a193f98659235708777e1acc64a4b03c.tar.bz2 |
Sketching the identify feature
-rw-r--r-- | gmap_arcgis.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js index d0bd721..07a4330 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -33,10 +33,10 @@ function gmapArcgis(config) { } }, - // TODO: support for clickable polygons // Add polygons from a given ArcGIS MapServer Layer showPolygon: function(params, store) { - params.overlay = new gmaps.ags.MapOverlay(params['uri'], { + params.service = new gmaps.ags.MapService(params['uri']); + params.overlay = new gmaps.ags.MapOverlay(params.service, { exportOptions: { layerIds: params['layers'], layerOption: 'show', @@ -46,6 +46,23 @@ function gmapArcgis(config) { params.overlay.setMap(this.map); params.overlay.setOpacity(params.opacity); + // TODO: support for clickable polygons + // See https://google-maps-utility-library-v3.googlecode.com/svn/trunk/arcgislink/examples/identify.js + if (typeof params.identify != 'undefined') { + google.maps.event.addListener(this.map, 'click', function(point) { + params.identify.geometry = point.latLng; + params.identify.bounds = this.map.getBounds(); + + params.service.identify(params.identify, function(results, err) { + if (err) { + alert(err.message + err.details.join('\n')); + } else { + //addResultToMap(results, evt.latLng); + } + }); + }); + } + if (params.callback == undefined) { // Default callback: remove the blockUI once the layer is shown google.maps.event.addListener(params.overlay.getMapService(), 'update', function() { @@ -60,7 +77,7 @@ function gmapArcgis(config) { return params.overlay; }, - + // Add a KML to the map showKML: function(element) { if (typeof this.config['kmls'][element].overlay == 'undefined') { @@ -99,7 +116,7 @@ function gmapArcgis(config) { if (this.config['layers'][element].overlayTime != undefined) { this.showOverlay(this.config['layers'][element].overlayTime); } - + this.config['layers'][element].overlay = this.showPolygon(this.config['layers'][element]); }, |