5

I'm developing some software using ArcGIS API, but the question is rather theoretical, as I just came from Google Maps and have no idea where to start; everything seems to be different including the metrics used. I'm not even sure how to explain what I want to understand, so I'll just shoot (don't shoot me if I misname something).

So, the very basic understanding I'm missing is the coordinate system. I'm creating a MapView, then I assign an Envelope (this probably to be the area displayed on the map, right?) as its extent. The problem starts here, Envelope requires some parameters that are definitely not latitude/longitude (I've tried those and the map was showing some random area). From the samples I could just figure out that numbers used are rather strange (something like 658346.0152817797, 6239589.28803324, 841568.832957386, 6366554.416159659) and are not coordinates. What are these numbers? And how can I transform my lat/lon coordinates into acceptable numbers?

3
  • Which of the ArcGIS API's are you using? Commented May 9, 2011 at 14:27
  • Are there more than one? Android API probably answers what you mean.. Commented May 9, 2011 at 15:52
  • "Android API" does answers it. FYI - there are multiple API depending on your technology/platform: Flex, Javascript, Silverlight, iOS, Windows Phone, and Android. Most of them have utility methods for easy switching between the "geographic" and "web mercator" coordinates. Commented May 10, 2011 at 5:22

3 Answers 3

12

Almost all of the web maps use a Web Mercator (Auxiliary Sphere) projection (WKID 3857). The parameters represent the coordinates for the edges of the viewing window. For example, were the coordinate system WGS84, the envelope for displaying the whole earth would have the following parameters:

XMin: -180  XMax: 180
Ymin: -90   YMax: 90

The reason the coordinates you have don't seem like coordinates are because they are measured in meters instead of angular degrees, thus they are very large. An envelope in this web projection for displaying the whole world would have these parameters:

Xmin: -20037700  XMax: 20037700
Ymin: -30241100  YMax: 30241100

If you have coordinates in degrees latitude and degrees longitude as a GPS unit would give you (WGS84 / NAD83) then you need to project those into the coordinate system of the map on which they are to display. This can be done in ArcMap with the Data Management Tools->Projections and Transformations->Feature->Project geoprocessing task, or you can do it dynamically by calling the same operation on an ArcGIS server through a Geometry service.

2
  • 1
    Current WKID is EPSG:3857. ESRI:102100 was changed to 3857 in version 10.
    – mkennedy
    Commented May 9, 2011 at 22:24
  • Thanks @mkennedy, I didn't realize it got a new ID.
    – dmsnell
    Commented Nov 8, 2013 at 13:10
4

Those coordinates are likely from a projected coordinate system and are in meters, though I could be wrong. Coordinate reference systems is a huge topic of which if got wrong has massive consequences - so you should understand at least the principles. Morten Nielsen did a good introduction on his blog:

http://www.sharpgis.net/post/2007/05/Spatial-references2c-coordinate-systems2c-projections2c-datums2c-ellipsoids-e28093-confusing.aspx

you should also review Esri's ArcGIS help.

2

If you have started with the Hello World Map sample, then your map will be in Web Mercator projection (Spatial Reference ID 102100 3857). To place your data on it you will have to reproject from WGS 1984 coordinates (Spatial Reference ID 4326).

To display your WGS 1984 on a Web Mercator map, you can use the GeometryEngine:

SpatialReference webSR = SpatialReference.create(3857);
Point webPoint = GeometryEngine.project(x, y, webSR);

If you're converting a polyline or polygon:

SpatialReference webSR = SpatialReference.create(3857);
SpatialReference wgsSR = SpatialReference.create(4326);
Geometry webPoly = GeometryEngine.project(wgsPoly, wgsSR, webSR);

N.B. If you're using another ArcGIS API, then you should expect the syntax to vary slightly. i.e. on the ArcGIS for Windows Phone API you construct a SpatialReference using new SpatialReference(srid).

1
  • it's been a while since I asked this question, so I figured out how to do it, but +1 for mentioning the actual methods: this is exactly what I'm doing now in my code. Commented Jan 23, 2012 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.