QueryTask, Query and Spatial References

1236
0
03-07-2013 07:20 AM
AaronConnolly
Occasional Contributor
I noticed that after upgrading from version 3.2 to 3.3 a query task that I was running began to fail. I originally thought it was related to a different problem that I was working on:

http://forums.arcgis.com/threads/78905-GeometryServic-Buffer-Task-amp-Access-Control-Allow-Origin

... however that was not true.

My query takes a buffer's geometry whose spatial reference is in web mercator, however my source data is in the geographic coordinate system. At version 3.2 the query task completed without any issues, but at 3.3 it seems that if you don't specify an 'outSpatialReference' on the Query object *and* the Query's geometry's spatial reference does not match the source data's spatial reference the query task will fail silently.

So, before upgrading to 3.3 I could do this, and the query task would not fail.

query.geometry = buffer.geometry;
queryTask.execute(query, taskCompleted, taskFailed);


and after upgrading to 3.3, I needed to do this:

query.geometry = buffer.geometry;
query.outSpatialReference = buffer.geometry.spatialReference;
queryTask.execute(query, taskCompleted, taskFailed);


Is this a known issue? The docs for the Query object just say that the output will take the spatial reference of the map, if not otherwise specified:

http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#Query

The docs also mention that outSpatialReference is optional:

"Optional properties include outFields, outSpatialReference, and returnGeometry."

Why does the query task fail if the source data being queried is geographic, but the query contains a web mercator projected polygon, and if you do not strictly specify an output spatial reference?

Thanks,
- Aaron
0 Kudos
0 Replies