IdentifyTask + InfoWindow 'Zoomto' button using wrong spatial reference

3629
13
Jump to solution
05-16-2014 08:43 AM
MS
by
New Contributor III
Hi

I'm using the following parameters in an identify task:

            var identifyParams = new IdentifyParameters();             identifyParams.tolerance = this.identifyTolerance;             identifyParams.returnGeometry = true;             identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_VISIBLE;             identifyParams.geometry = evt.mapPoint;             identifyParams.mapExtent = this.map.extent;          identifyParams.spatialReference = this.map.spatialReference;             identifyParams.width = this.map.width;             identifyParams.height = this.map.height;


Problem is, when I get the infoWindow when clicking on the map, I receive the following error:

Map: Geometry (wkid: 4326) cannot be converted to spatial reference of the map (wkid: 2151)

I'm struggling to understand where the wkid 4326 is coming from, as everything to and from the identifyTask is in 2151.  I've debugged the code to note that yes, 'this.map.spatialReference' is of wkid 2151.  I've logged the network traffic going to our ArcGIS Server, and yes, the request being sent includes a spatial reference of wkid 2151 in the URL.  I've looked at the MapService that it's doing the identify on, and the MapService is of wkid 2151.  I tried going right to the identify task right on the ArcGIS Server via a web browser, put in my variables at performed an Identify there, and it gave me back the right spatial reference as well.

Anyone have any idea where the 'geometry of wkid 4326' is coming from?
0 Kudos
13 Replies
deleted-user-iPdcWUgWcsoy
New Contributor III

Indirectly, this is a Bug in the JSAPI as AJ Morris said. The problem is, that since ArcGIS for Server 10.2(.2) there is no spatial reference in the returning geometry of identify result. In ArcGIS for Server 10.1 the spatial reference still exists in identify result. So perhaps the JSAPI takes a default spatial reference for returning geometry which is 4326 (WGS84) and not the requested one.

So I thing there is a bug in ArcGIS for Server 10.2. But the solution described above works for me too and is a good workaround. So thanks !

MirceaMaierean
New Contributor III

Same thing happened to one of my webmaps after we have updated our servers to 10.2.2 . That piece of code worked like a charm!

0 Kudos
YanLIGIS
New Contributor

Unfortunately used identifyTask and spent the past several days to figure out what's wrong with this wkid:4326.

0 Kudos
BjornSvensson
Esri Regular Contributor

Thanks for reporting this.

Seems like the workaround mentioned "fixes" this. We will also look at fixing it properly in the Javascript 3.12 version.

result.feature.geometry.spatialReference = this.map.spatialReference;