QueryTask, Query and Spatial References

Discussion created by aconnolly on Mar 7, 2013
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:

... 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:

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?

- Aaron