Newbie Q: Got coordinates of polygon in map units; convert to lat/lon?

307
4
12-13-2013 07:29 AM
New Contributor II
This seems like it's probably a slap-your-head easy problem, but an hour of googling forum-browsing and I'm still stuck, likely because I just don't know the terminology to use.

Anyway: I'm using the DrawTool to draw a polygon, then I need to find the lat/lon coordinates of each point in the polygon.  I grab athe Polygon object from the graphics layer's graphicProvider property, then I've got an array of MapPoints for each Ring in the polygon, but the MapPoints are clearly not in lat/lon.  Based on what I've read it sounds like they're in UTM format?

I am (I believe) using the web mercator (wkid: 102100), which other forum posts seem to say should mean this is a straightforward conversion.

So... how do I do it?

Thanks.
Tags (2)
1 Solution

Accepted Solutions
by
Regular Contributor
Daniel,

There is a sample linked on the page also..

https://developers.arcgis.com/en/flex/api-reference/index.html?com/esri/ags/utils/WebMercatorUtil.ht...

If that does not work you are going to have to 'project' the geometry using a Geometry Service...

Drew
4 Replies
by
Regular Contributor
Daniel,

There is a sample linked on the page also..

https://developers.arcgis.com/en/flex/api-reference/index.html?com/esri/ags/utils/WebMercatorUtil.ht...

If that does not work you are going to have to 'project' the geometry using a Geometry Service...

Drew
New Contributor II
Yes, fantastic!  That did it.  For anyone else reading this, the specific code I'm now using to take a Graphic (which is of type Polygon) is:

`var polygonInGeoCoords:Polygon = WebMercatorUtil.webMercatorToGeographic(myGraphic.geometry) as Polygon;`

Thank you!

Daniel,

There is a sample linked on the page also..

https://developers.arcgis.com/en/flex/api-reference/index.html?com/esri/ags/utils/WebMercatorUtil.ht...

If that does not work you are going to have to 'project' the geometry using a Geometry Service...

Drew

by
Regular Contributor
Glad to hear it worked out.
If you don't mind, please mark the thread as answered. That way it will help others know there is a solution to the question.

Drew
New Contributor II
Done.  I'm used to doing that on StackOverflow, but hadn't seen the "checkmark" on any other forums... good to know.

Glad to hear it worked out.
If you don't mind, please mark the thread as answered. That way it will help others know there is a solution to the question.

Drew