2

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.

  • I do now:
    • Equirectangular - RIGHT after I posted of course.
    • Also known as Platte Carre (per Hal Mueller's comment)

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.

  • Please post screenshots of WhirlyGlobe and SceneKit versions, and the code for a MCVE (http://stackoverflow.com/help/mcve). Where are your map tiles being generated? Can you configure that server to return Platte Caree tiles? A spherical Mercator raster map will need reprojection to be overlaid on a sphere, and in any case won't extend to the poles. – Hal Mueller Jan 01 '17 at 08:34
  • We are using TileMill to generate the tiles and it can export the SM projection but not the Platte Caree/Equirectangular projection. The tiles are embedded so no server. Regarding the poles, yeah, I saw that after I posted this in learning more about SM and PC projections. I don't see any value in posting a MCVE. I have a scene with a sphere with an SCNMaterial. What I am doing works perfectly. (well...wrt what I am asking anyway.) :-) I am thinking this should be in another SE category. Thanks! – Jillian Priese Jan 03 '17 at 15:14
  • MapServer can render PC images, tiled if necessary. But that's a big workflow change from Tilemill. Consider GDAL/OGR if you already have images in hand and just need to reproject them. – Hal Mueller Jan 03 '17 at 18:39
  • There it is. Please make GDAL an answer. I used that (and some other stuff I'll outline in a comment on your answer). I was trying to make Blender work, but man, that was brutal. Got close (I think anyway.) Super big thanks! – Jillian Priese Jan 04 '17 at 19:39

1 Answers1

2

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.

Hal Mueller
  • 7,019
  • 2
  • 24
  • 42
  • The solution was to do a super big (6400x~6400) export of the Spherical Mercator projection to use for reproduction and editing. Per Hal Mueller’s comment/answer, I downloaded the macOS version of [GDAL](http://www.gdal.org/index.html) and used this [GIS.StackExchange](http://gis.stackexchange.com/questions/92907/re-project-raster-image-from-mercator-to-equirectangular#92954) post to reproject to Equirectangular....(continued) – Jillian Priese Jan 04 '17 at 20:51
  • 1
    But that was not enough. The output has a couple of problems. First, I think the PNG is not standard. I opened in Acorn and straight up re-exported as a PNG to clean that up. Second, it is missing the last ~5 degrees north and south at the poles. Next up, I opened cleaned up PNG in [G.Projector](http://www.giss.nasa.gov/tools/gprojector/) with a northern offset of 85.011 and a southern offset of -85.011. The map perfectly aligned with the overlays. But had a gap at the top....(continued) – Jillian Priese Jan 04 '17 at 20:53
  • I then hid the overlays and saved the map in Equirectangular projection with the background colored black (this is the border). I set the dimensions to 6400x3200 to preserve as much precision as possible.I then opened the file in Acorn. I stretched the imaged horizontally to close the side margins and filled the top/bottom margins with droppered colors from the last row of pixels. I then saved and did a “web export” of a 1600x800 PNG for the SCNSphere’s SCNMaterial’s diffuse.contents property. – Jillian Priese Jan 04 '17 at 20:54