Recently, we upgraded our ArcGIS Server from 10.0 to 10.22, and some functions in our apps began to have some issues.
Upon further investigation, I realized the return graphic(s) from executing IdentifyTask had wkid 4326 spatialReference even if it was specifically set to be wkid 100210. In addition, if the data source was on old ArcGIS Server 10, it would function normally (that is, the spatialReference of return graphics/features remained the same as the map.spatialReference). However, if the data source was pointing to our new ArcGIS Server 10.22, the spatialReference of the results would become wkid 4326 despite setting it to wkid 100210.
Note: Query and QueryTask do NOT have the same problem, and the spatialReference stay the same.
I don't know if the problem was caused by the API or ArcGIS Server 10.22.
Don't know if other people also observe the same issue.
Sever: Win Server 2012 RS and ArcGIS Server 10.22
If you search a little more on these forums, you'll see this is a known bug.
I did do a search before posting, but failed to find anything.
Thanks for letting me know that.
Do you know the source of the problem? From the API or ArcGIS Server?
I don't know what ESRI has done to their search engine. I can't see1/2 the entries I used to be able to find. There were several threads that used to come up toward the top on the old forum if you searched on Identifytask and spatialreference.
I wish I could find the thread again or the project where I had to put the workaround. There is a particular place in the code that you have to specify the spatialReference again, since it doesn't inherit from either the layer or the map. Hopefully they'll fix the task in a future release.
Assigning spatialReference after getting the result(s) does provide the walkaround. Thanks.
Btw, I have not found the exact source of problem, but many think it is because of ArcGIS Server 10.22.
Oh my! I am experiencing this too!
I tried to step down from JS API 3.10 to 3.7 but they all had the same issue and my app stopped working with <3.7.
Services from ArcGIS for Server 10.2.2.
Interestingly, the the identifyTask seemed to work with points fine, but polygons came back with the right coordinate values, but with spatialReference 4326. Regardless of relevant settings in IdentifyParameters.
Another strange thing is that the REST interface seems to return the correct spatialReference if I use the HTML interface of that service.
Re-setting the spatial reference is not an option for real use and projecting each feature (IdentifyTask + InfoWindow 'Zoomto' button using wrong spatial reference)is not only demanding, but it wouldn't work because the coordinates are fine, just the spatial reference is wrong.
Please share any news about this topic!
Re-setting the spatial reference is not an option for real use and projecting each feature is not only demanding, but it wouldn't work because the coordinates are fine, just the spatial reference is wrong.
I think you are misinterpreting this workaround. You would not actually be sending any data back to the server for reprojection, all you would be doing is fixing the incorrectly assigned spatial reference in the returned object (nothing is doing a round trip to the server in that workaround).
Hi Robert, yep, I know, yet even that is awkward.
It is also what I am doing now : feature.geometry.spatialReference = map.spatialReference;
But if you allow users to add whatever service they like into the application, you don't want to make the assumption that the features you are getting are in the map's spatialReference. I guess I could check the service they add for spatial reference and set it from there, but there may be a point where you simply get some features from somewhere who knows where. It would be nice if the spatialReference was correct.