This tutorial requires WhirlyGlobe-Maply version 2.4 or greater.
NASA provides a wealth of earth imagery and remote sensing data. Most of it needs to be reprocessed in some way for visual display, but some can be used directly. The Global Imagery Browse Services or GIBS site provides a variety of imagery layers we can use directly in WhirlyGlobe-Maply.
You’ll need to have done the Remote Image Layer tutorial. Open your HelloEarth project and get ready.
If you haven’t got one here is a suitable ViewController file to start with (for Objective-C or Swift). This version has a remote image layer already configured and it makes a nice starting point.
In this tutorial we are going to get a base layer map from the GIBS site, and then we will add an overlay layer to that globe.
NASA GIBS base layer tile sources
The NASA GIBS site has a dizzying array of data sources to choose from. If you poke around their WMS XML you can find all sorts of things. We’ll pick one of the layers to dispaly, the corrected reflectance product.
All we need to do is replace the existing MaplyRemoteTileSource URL with one supplied thru the GIBS website. Here are two URLs that provide a base layer for your Whirly Globe.
Now let’s decipher these URLs. A reading of the GIBS API reference shows that the string has the format;
Open ViewController. Now let’s find where to add the image layer URL. Scroll down thru viewDidLoad until you find the following code for a MaplyRemoteTileSource;
Replace the first parameter of your init method with one of the selections above.
Also change ext: to “jpg”
And match the maxZoom with the level of the GoogleMapCompatible Level (8 or 9)
Run the project, and you should get something like this.
That gives us a nice night basemap, but many of the GIBS layers are overlays and work best on top of other data.
Adding an Overlay Layer
For our next feat let’s add an overlay image to our globe. Below are a couple of GIBS URLs for overlay suitable data sets.
Add this above viewDidLoad
Now just add this code to the bottom of ViewDidLoad, above the addCountries call.
Next, you can change the MaplyRemoteTileSource to any of the URLs provided above.
If you do change the URL, be sure to change the name of the cache directory. Otherwise you’ll get a combination of new and old data.
Change the first parameter of your init method to any of the URLs listed above.
And don’t forget to match the maxZoom level.
That’s it! Build and run. You should see some sweet NASA data!
That’s all there is to it. Here’s a working ViewController if you need it (for Objective-C or Swift).