cwright25

IdentifyTask Returning Feature Geometries in Wrong Coordinate System

Discussion created by cwright25 on Jan 30, 2012
Latest reply on Nov 15, 2012 by david.caseiro-esri-portugal-pt-esridist
When mixing layers from two different coordinate systems, the IdentifyTask should return the geometries in the coordinate system specified by the spatial reference in the IdentifyParameters.  Instead it is always returning the geometries in the original coordinate system of the map layer the results are from, even though this is not the documented behavior in the REST API. 

To replicate:

1. Add a Layer from ArcGISOnline that is in Web Mercator
2. Add a dynamic map layer from a custom server in a projected coordinate system (I used 2264).
3. Either:
    a. Set the SpatialReference IdentifyParameter to Web Mercator
    b. Don't set the parameter at all
    c. Set the parameter = to the map SpatialReference object
4. Execute the task, sending in an identify geometry in Web Mercator

To work around I am reprojecting the coordinates back to Web Mercator using the GeometryEngine.

However, something seems very wrong as the REST service always returns the geometries in Web Mercator when I hit the REST service directly via a URL, or use the JavaScript API, and also does not contain an outSR parameter.  It seems like the Android SDK must be taking the result, which is in the coordinate system I need to be able to draw the graphics as a highlight on the map, and must be converting it on the client to the layer's spatial reference, thusly forcing me to convert it back again.  This seems like it is causing a lot of unneccessary CPU cycles on the client device.

Is there anything that I am missing or doing wrong?

Outcomes