Thursday, July 26, 2007

Which projection to use when converting shapes/vectors to GoogleEarth in ArcGIS?

Which projection to use when converting shapes/vectors to GoogleEarth in ArcGIS? This was a question that I had recently while making a tool that would convert vectors from ArcGIS files to KML representation. If you read Spatial references, coordinate systems, projections, datums, ellipsoids – confusing? (SharpGIS, Morton), you will see that all of these online GIS apps use a Spherical Mercator projection. (Typically Mercator projections have a small amount of flatenning applied, in these online app's cases its a perfectly spherical spheroid!). If you read the following 3 articles, you will also find that they reflect the fact that these apps use a Spherical Mercator projection. Well based on this information I tried using a spherical Mercator projection as the destination spatial reference while converting the data-sets that I had. Unfortunately this just would not work. At first I first tried the spatial reference WKT string from Morton's site PROJCS["Mercator Spheric", GEOGCS["WGS84based_GCS", DATUM"WGS84based_Datum", SPHEROID["WGS84based_Sphere", 6378137, 0], TOWGS84[0, 0, 0, 0, 0, 0, 0]], PRIMEM["Greenwich", 0, AUTHORITY["EPSG", "8901"]], UNIT["degree", 0.0174532925199433, AUTHORITY["EPSG", "9102"]], AXIS["E", EAST], AXIS["N", NORTH]], PROJECTION ["Mercator"], PARAMETER["False_Easting", 0], PARAMETER["False_Northing", 0], PARAMETER["Central_Meridian", 0], PARAMETER["Latitude_of_origin", 0], UNIT["metre", 1, AUTHORITY["EPSG", "9001"]], AXIS["East", EAST], AXIS["North", NORTH]] This did not work. Outputting values that were outside the valid range of lat and long values. Then I tried the Mercator-Global projection that is a pre-defined projection in ArcMap. That output values similar to Morton's Spherical Mercator projection. (So it doesnt look like the ToWGS84 does anything in ArcGIS). The WKTString for Mercator-Global projection (this has been modified to be a spherical mercator). PROJCS["Spherical_Mercator",GEOGCS["GCS_WGS_1984_Based",DATUM["D_WGS_1984_Based",SPHEROID["WGS_1984_Based",6378137,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Standard_Parallel_1",0],UNIT["Meter",1]] So I tried the basic Geographic Coordinate System defined for WGS 1984 GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] This worked!!! So in short the destination coordinate system should be the WGS 1984 geographic coordinate system when you are attempting to convert coordinates for output to GoogleEarth, Virtual Earth or Yahoo Maps. I am not sure why the Spherical Mercator projections as destination did not work, so if anyone knows do leave a comment. The weird thing was that the converted coordinates were way out of the legal range of lattitude and longitude values. (ok this is duh! on my part - See comment by SharpGIS)


Morten Nielsen said...

Mercator does not output in longitude/latitude ! The values it outputs are correct.

If you want to create image overlays, you should use this mercator projection to projection your images.

If you on the other hand programmetrically want to add features to the map, Google Maps expects you to input them in Lat/Long based on the WGS84 spheroid (internally it will project it to the spheric mercator)

Anonymous said...

Just to nitpick... there is no such thing as a geographic projection. Either you have geographic or you have projected.
Read the blogpost you link to.

Raj Rao said...

I agree - it should be Geographic Coordinate System - its been corrected.