2

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).

  • 1
    Look at PROJ.4? Look at Snyder's Map Projections: A Working Manual? You'll have to implement (or find) transverse Mercator (ellipsoidal) and Mercator (spherical), possibly also a zone finder/converter for the UTM. – mkennedy Dec 23 '16 at 0:45
  • Is C++ an option for you ? – Shiko Dec 23 '16 at 4:23
1

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/

  • It seems that GeographicLib uses the ellipsoidal algoroithms, while 900913 uses spehrical. Please tell me I'm wrong so I can continue using GeographicLib. – Constantin Apr 25 '17 at 15:00
  • The more I stare at this, the more I'm thinking of using the LambertConformalConic with a==WGS_84::a(), f==0, stdlat==0, k==1 – Constantin Apr 25 '17 at 15:09
1

I'm the author of Snyder Map Projections for Android and have used the code for various Remote Sensing agencies since it implements ALL projection equations in their entirety.

Currently only the Java code is available; however, the projections are easy ported to other languages including Swift (I ported a few projections privately). Don't be overwhelmed with the amount of code... the projections were designed to be wholly independent from one another specifically for language porting reasons.

https://github.com/apispoint/snyder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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