GeometryService issue with Attributes

502
5
03-04-2014 11:21 AM
LuisGarcia2
Occasional Contributor II
I am using a GeometryService to re-project some graphics. When I am creating the graphics to be sent for re-projection, I add information in the "Attributes" dictionary property. I was hoping that those items would come back in the result of the re-projection; but, apparently the Graphics are returning with an empty Attribute dictionary property. Is that the way this is supposed to work? How can I solve that? In my application it is important to preserve that information after I'm done re-projecting, any suggestion how I can accomplish that?
Thanks!
0 Kudos
5 Replies
AhmedEl-Sisi
Occasional Contributor III
Geometry Service will return geometries only and they will be in the same order as input graphics.

In Project Completed Handler you can assign your attributes (or modify the geometry)with the same index.

Check this post:
http://forums.arcgis.com/threads/98623-Geometry-Service-Attribute-Retention
0 Kudos
LuisGarcia2
Occasional Contributor II
Thanks for your reply. Yes, I experimented with the user token yesterday and added a list as a token with all the attributes I need to have back. They seem to comeback in the same order as you mentioned. Yesterday, I was discourage of using that for production though. I thought that was unsafe to just trust the order of a list. If there is nothing else then I guess that would do for now. Hopefully ESRI will address that at some point.
0 Kudos
AhmedEl-Sisi
Occasional Contributor III
Basically any failure for projecting any point in your list will return Its Coordinates with NaN so you can rely on order but this is not mentioned in REST Api.
Check REST API for more information

If you need another workaround, My first choice here is to project points locally on client side but this depend on your input and output Spatial reference.
I had a business case before to project list of points from different UTM zones to GCS_wgs_1984 which can't be done by Geometry Service with single request and also have a list order concern, so I got some equations to convert them on client side.
another approach is go for your custom GP service for projection and preserve your attributes.
0 Kudos
LuisGarcia2
Occasional Contributor II
Thanks for your reply, very helpful. You mentioned creating my own client side projection. I tried that  but I could not figure out the correct math equations. All my data is in NAD27, Spatial reference 4267 and I need to project it to WebMercator, Spatial reference 102100 to go in the map. It would be interesting to know how you figure out your own if you can share, where did you find the math equations, etc.
thanks!!
0 Kudos
AhmedEl-Sisi
Occasional Contributor III
Thanks for your reply, very helpful. You mentioned creating my own client side projection. I tried that  but I could not figure out the correct math equations. All my data is in NAD27, Spatial reference 4267 and I need to project it to WebMercator, Spatial reference 102100 to go in the map. It would be interesting to know how you figure out your own if you can share, where did you find the math equations, etc.
thanks!!

There was alot of available equations in my case as I need to convert from UTM to wgs84.
You can check Proj.Net as it offers projection from NAD27 to wgs84 (4326) the you can convert to WebMercator, but you need to test the results carefully to insure correct transformation process.
0 Kudos