When I attempt to add XY Data to my map the lat and lon coordinates are projected in meters for example (-82, 34) becomes -82 meters and 34 meters. The GCS and Projection for both the new layer and the data frame are WGS 1984 Web Mercator (auxiliary sphere). Why is the new layer's XY Data displaying incorrectly?
Asked
Active
Viewed 176 times
1
-
3Welcome to GIS SE, can you edit your question or tag to indicate what software you are using? Try changing your data frame projection to match the CRS of the xy coordinates you are wanting to add in. – artwork21 Aug 08 '16 at 13:46
-
1please see http://meta.gis.stackexchange.com/questions/3349/framing-asking-good-questions-for-gis-stack-exchange?cb=1 for a discussion on how to ask a good question – Ian Turton Aug 08 '16 at 15:10
1 Answers
0
Web Mercator is in Meters (3857) Projected, WGS94 is (4326) is Lat/Longs, Geographic Projection. It's really one or the other, they both use the same datum but one(Web Mercator)is projected the other not.
The data was stored in Web Mercator for mapping, thus the geometry shows these coordinates in Meters, Lat/Longs in the feature attributes are the coordinates for the Geographic projection.
To convert from Web to Lat/ Long in JavaScript:
function MercatorToLatLon(mercX, mercY) {
var rMajor = 6378137; //Equatorial Radius, WGS84
var shift = Math.PI * rMajor;
var lon = mercX / shift * 180.0;
var lat = mercY / shift * 180.0;
lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180.0)) - Math.PI / 2.0);
return { 'Lon': lon, 'Lat': lat };
}
Bill Chappell
- 4,790
- 1
- 21
- 30