iosscenekitmercatorscnmaterial

How do I use a web mercator projection map for SCNMaterial on an SCNShere geometry?


I have a simple globe view in my app. Previously we were using WhirlyGlobe, but have opted to use SceneKit instead. Everything works great and we are happy with it EXCEPT we used map tiles in Whirly Globe and the do not work (as far as I can tell) in SceneKit. We want to use that map (tiled, split or as one file) on an SCNSphere geometry.

I copied the satellite map that Apple uses in their documentation and it looks right, but is not the map we need. Our map is in web/sphere mercator projection and it looks bad in SceneKit on my sphere.

I do not* know what the 2x1 projection Apple is using is called, so JUST that information might be enough for me to find the solution.

An export of our map in the web mercator projection is 1x1. Just squishing it in the vertical axis does not work (SceneKit does this automatically anyway).

I can convert the file programmatically, using a tool or some hybrid if needed.

If needed, I can provide thumbs of the map skins.


Solution

  • If you already have images and need to reproject them (say from Mercator to Plate Carree/Equirectangular), take a look at GDAL (http://www.gdal.org). In addition to the format conversions, it contains a reprojection library. GDAL runs on most systems, and can be used from the command line or bundled into other programs.