Select to view content in your preferred language

GeometryService.ProjectAsync returning unexpected geometries

1042
3
12-15-2010 10:05 AM
KevinSchumm
Emerging Contributor
We have a map that has a spatial reference with a WKID of 32023. We're using the Bing layer, so I've set the Map in the silverlight app's spatial reference to 102100 to make them play together.

We're also using the the FeatureService to save features. So in order to save the features correctly, I'm attempting to use the GeometryService to project the geometry to the correct spatial reference. However, when I do this I'm finding that the coordinates aren't exact, so the new feature doesn't display on the map as expected.

I've got a point that, when the Bing layers are removed, looks like this:
X: 2020341.1106
Y: 586583.9612
WKID: 32023

When the Bing layer is on and I've set the spatial reference to 102100, the point looks like this:
x:-9175820.9161
Y:4809507.2491
WKID:102100

I'm attempting to add a feature in that exact position, so I take those coordinates and then use the GeometryService to project them to WKID: 32023 with the following code:

GeometryService service = new GeometryService("http://ourserver/ArcGIS/rest/services/Geometry/GeometryServer");
service.ProjectAsync(new List<Graphic>
{
new Graphic
{
Geometry = point
}
},
new SpatialReference
{
WKID = 32023
});

where "point" is the above referenced MapPoint with WKID: 102100.

What I get back is a MapPoint that looks like this:
X: 2020297.9677
Y: 586571.4118
WKID: 32023

So it's close, but close isn't cutting it for me. Would anyone have any advice on what I might doing wrong or what I should do instead?
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
You get the same results when you perform the project from the web browser?

Replace this with your own Geometry Service URL: http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/project

Or compare the results from SL app, your Geometry Service and Sample Server 3 Geometry Service.

You can get the actual parameters using Fiddler: (Post #14 in this thread)
http://forums.arcgis.com/threads/14730-Area-And-Perimeter
0 Kudos
KevinSchumm
Emerging Contributor
Jennifer,

Here are the params sent to the Geometry Service (from Fiddler):

inSR: 102100
outSR: 32023
geometries: -9175820.91612625,4809507.24918867
f: json

and the results from the service:

{
  "geometryType" : "esriGeometryPoint",
 
  "geometries" :
  [
    {
      "x" : 2020297.96773847,
      "y" : 586571.411815907
    }
  ]
}

Looks to be same results I was getting in the application.

The results are the same from the sample service.
0 Kudos
JenniferNery
Esri Regular Contributor
Thank you for sharing this information with us. I asked the REST API team about this and here's the reply I got:

Geometry service project operation via REST does not support datum transformation.  In the case when a transformation is not provided to the geometry service project method, only 3 default transformations are used. Please see
http://help.arcgis.com/en/sdk/10.0/arcobjects_cpp/componenthelp/index.html#//000w00000205000000

For transformation between WGS1984 to NAD_1927, the default transformation used is:
esriSRGeoTransformation_NAD1927_To_WGS1984_4, forward and reverse, WKID = 1173

There are ~30 or so different transformations that can be applied for transformation between WGS1984 and NAD1927 and the results will vary depending upon which one is used. If the user is referencing the expected output based on transformation other than esriSRGeoTransformation_NAD1927_To_WGS1984_4, then the results returned by the project operation will be different.

One suggestion I have for this user is to edit/add the feature directly in 102100. Feature service will be able to store the geometry in 32023 and will use the default transformation that is set in the map.



If you have further questions about this, please post in their forum. http://forums.arcgis.com/forums/11-ArcGIS-Server-REST-API
0 Kudos