[GIS] Convert UTM to Web Mercator

coordinate systemutmweb-mappingweb-mercator

I'm looking to programmatically convert UTM to Web Mercator (a.k.a. Spherical Mercator, EPSG:3857, EPSG:3785, OpenLayers:900913). I'm looking for the algorithm, or something that runs on iOS (Swift, Objective-C or even C). The GDAL C library is not an option to due its huge size (this will be running on a mobile device).

Best Answer

GeographicLib is open source library with implementation in several languages:

  • C (geodesic routines): documentation, also included with recent versions of proj.4;
  • Fortran (geodesic routines): documentation;
  • Java (geodesic routines): Maven Central package, documentation;
  • JavaScript (geodesic routines): npm package, documentation;
  • Python (geodesic routines): PyPI package, documentation; Matlab/Octave (geodesic and some other routines): Matlab Central package, documentation;
  • C# (.NET wrapper for complete C++ library): documentation;
  • IDL (not part of GeographicLib): solving the inverse geodesic problem in IDL by Sean Elvidge and Chris Mannix;
  • C# (not part of GeographicLib): GeographicLib (C#) by Surya Pratap (the same capability is provided by the NETGeographicLib);
  • Mathematica (not part of GeographicLib): mathematica-geodesic by Kei Misawa.

Reference:
http://geographiclib.sourceforge.net/