QueryTask outSpatialReference

2747
5
Jump to solution
12-14-2012 07:36 AM
AndyStewart1
New Contributor III
I am working for a client that has a Tiled Basemap in one Spatial Reference (3857) and a Dynamic Map Service Layer in another Spatial Reference (wkt: PROJCS["USA_Contiguous_Albers_Equal_Area_Conic",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Albers"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-96.0],PARAMETER["Standard_Parallel_1",29.5],PARAMETER["Standard_Parallel_2",45.5],PARAMETER["Latitude_Of_Origin",37.5],UNIT["Foot",0.3048]]).

I figured out how to project the Dynamic Map onto the Tiled map but for some reason when I do a QueryTask it doesn't transform the dynamic data into the new projection. I have set the outSpatialReference to 3857 and it doesn't change it. My guess is the well-known text for the dynamic map is keeping it from changing coordinates. I even went into the REST Services and tried a Query from there with the new outSpatialReference and it didn't work. I have included images to explain what I did.

One thing I figured out is that if I use the GeometryService.project() method it will change the coordinates fine, but that is a much more cumbersome solution for the application I am building.

[ATTACH=CONFIG]19943[/ATTACH] [ATTACH=CONFIG]19944[/ATTACH]
0 Kudos
1 Solution

Accepted Solutions
AndyStewart1
New Contributor III
It turns out that QueryTask doesn't convert the coordinates when done on Event Layers where the shape is derived from other layers. FindTask does convert them, so we are having to rewrite things to work with FindTask in certain parts.

View solution in original post

0 Kudos
5 Replies
by Anonymous User
Not applicable
Original User: jeff.pace

according to the API

outSR Description: The spatial reference of the returned geometry.

The spatial reference can be specified as either a well-known ID or as a spatial reference json object.

If outSR is not specified, the geometry is returned in the spatial reference of the map.


so

{"wkid" : 3857}

in the SR field
0 Kudos
AndyStewart1
New Contributor III
Do you mean like this?

[ATTACH=CONFIG]19954[/ATTACH]

That didn't work either.
0 Kudos
by Anonymous User
Not applicable
Original User: jgravois

specifying the outSpatialReference as a number is definitely correct.

heres a working example which executes a query of a service utilizing a WKT projection definition and requests different coordinates back.  this service is running on ArcGIS Server version 10.0

entering either "102100" or "3857" as the Output Spatial Reference (without the quotes) converts to web mercator, leaving the parameter blank retrieves the coordinates in the same spatial reference as the service itself.

what version of ArcGIS Server are you currently working with?
are you executing a spatial query or an attribute query?
0 Kudos
AndyStewart1
New Contributor III
The ArcGIS Server is 10.11 but the ArcSDE database is 9.3. There was an issue earlier with the 9.3/10.1 incompatibility that was fixed with a service pack update. We have been thinking that this may be another issue with the older database. I have a different test environment that runs 10.0 and the transformation works fine. It is just in this environment that things aren't happening as they should.
0 Kudos
AndyStewart1
New Contributor III
It turns out that QueryTask doesn't convert the coordinates when done on Event Layers where the shape is derived from other layers. FindTask does convert them, so we are having to rewrite things to work with FindTask in certain parts.
0 Kudos