NASA EOSDIS maps not "wrapped" to globe properly? WebMapTileServiceImageryProvider

I’m trying to access some NASA EOSDIS map providers and render them on Cesium. The wrapping of tiles seems wrong, not extending to South Pole, and distorting such that the norther hemisphere is compressed while the southern is expanded. I’m not a GIS guy so I’m having trouble wrapping my head around what I’m doing wrong.

Any suggestions? Is it some bounding box that I’m not defining or the tilingScheme?

Once I get this working I’d like to contribute some code which uses this along with the “time” parameter that allows us to see date-stamped tile sets.

Thanks for any pointers.

NASA claims to support OGC WMTS and Tiled WMS:

https://earthdata.nasa.gov/about-eosdis/system-description/global-imagery-browse-services-gibs/gibs-access-methods

While I can’t get their WMS to render at all, I can get WMTS to render using (for example):

var wmts = new WebMapTileServiceImageryProvider({

    url: 'http://map1.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi',

    layer: 'MODIS_Terra_CorrectedReflectance_TrueColor',

    tileMatrixSetID: 'EPSG4326_250m',

    format: 'image/jpeg',

    style: '',

});

But the tiles don’t seem to be mapping all the way around the south pole, for example:

Using an Earth at Night dataset (layer: ‘VIIRS_CityLights_2012’, 'tileMatrixSetID: ‘EPSG4326_500m’, format: ‘image/jpeg’), I can see that North America is squished near the North Pole and South America is bloated to cover most of the globe:

And same squish/bloat and south-pole cut-off with ‘layer’: ‘MODIS_Terra_Land_Surface_Temp_Day’, ‘tileMatrixSetId’: ‘EPSG4326_1km’, ‘format’=‘image/png’:

I’m also seeing in the JavaScript console reports on some 400 errors from the server; e.g.:

http://map1.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi?service=WMTS&VERSION=1.0.0&request=GetTile&TILEMATRIX=2&LAYER=MODIS_Terra_CorrectedReflectance_TrueColor&STYLE=&TILEROW=3&TILECOL=0&TILEMATRIXSET=EPSG4326_250m&FORMAT=image/jpeg

<?xml version="1.0" encoding="UTF-8"?>

TILEROW is out of range, maximum value is 2

The service responds to GetCapabilities at

http://map1.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi?SERVICE=WMTS&request=GetCapabilities

and the layers for the sample images above are defined like:

ows:TitleMODIS_Terra_CorrectedReflectance_TrueColor</ows:Title>

<ows:WGS84BoundingBox crs=“urn:ogc:def:crs:OGC:1.3:CRS84”>

<ows:LowerCorner>-180 -90</ows:LowerCorner>

<ows:UpperCorner>180 90</ows:UpperCorner>

</ows:WGS84BoundingBox>

ows:IdentifierMODIS_Terra_CorrectedReflectance_TrueColor</ows:Identifier>

default default

image/jpeg

<ows:Identifier>time</ows:Identifier>

<UOM>ISO8601</UOM>

<Default>2014-09-23</Default>

<Current>false</Current>

<Value>2012-05-08/2014-09-23/P1D</Value>
<TileMatrixSet>EPSG4326_250m</TileMatrixSet>

ows:TitleVIIRS_EarthAtNight_2012</ows:Title>

<ows:WGS84BoundingBox crs=“urn:ogc:def:crs:OGC:1.3:CRS84”>

<ows:LowerCorner>-180 -90</ows:LowerCorner>

<ows:UpperCorner>180 90</ows:UpperCorner>

</ows:WGS84BoundingBox>

ows:IdentifierVIIRS_CityLights_2012</ows:Identifier>

default default

image/jpeg

<TileMatrixSet>EPSG4326_500m</TileMatrixSet>

I looked into this a bit. The data is documented as being equidistant cylindrical, so you’ll need to change the tilingScheme to a GeographicTilingScheme instead of the default web mercator.

For example:

var viewer = new Cesium.CesiumWidget(‘cesiumContainer’, {

imageryProvider: new Cesium.WebMapTileServiceImageryProvider({

url: ‘http://map1.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi’,

layer: ‘MODIS_Terra_CorrectedReflectance_TrueColor’,

tileMatrixSetID: ‘EPSG4326_250m’,

format: ‘image/jpeg’,

style: ‘’,

tilingScheme : new Cesium.GeographicTilingScheme(),

tileWidth : 512,

tileHeight : 512

})

});

It still doesn’t look right though, and I’m not sure how to properly make sense of the actual images.

If you look at the two root tiles directly:

https://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi?TIME=2014-09-23&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=MODIS_Terra_CorrectedReflectance_TrueColor&STYLE=&TILEMATRIXSET=EPSG4326_250m&TILEMATRIX=0&TILEROW=0&TILECOL=0&FORMAT=image%2Fjpeg

https://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi?TIME=2014-09-23&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=MODIS_Terra_CorrectedReflectance_TrueColor&STYLE=&TILEMATRIXSET=EPSG4326_250m&TILEMATRIX=0&TILEROW=0&TILECOL=1&FORMAT=image%2Fjpeg

You’ll see that the imagery doesn’t actually line up with the tile edges at all, in either direction. The tiles are consistent with themselves, in the sense that as you zoom in and out, the higher-detail tiles match the lower-detail tiles.

If you compare to another EPSG:4326 imagery source:

http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer/tile/0/0/0

http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer/tile/0/0/1

The imagery fills the tiles completely as I’d expect, which is why it looks correct when you view that data source.

Not sure what’s going on here.

Yes, it certainly seems like that WMTS server is returning improperly georeferenced images. Perhaps there’s some subtlety I’m missing - an unusual ScaleDenominator, which Cesium ignores entirely? - but these images are non-standard at best.

Kevin

Strange, I tried the

tilingScheme: new Cesium.GeographicTilingScheme()

and don’t see any (?) improvement either, and verified the same behavior by dropping Scott’s code into HelloWorld.html.

I’m gonna have to reach out to the EOSDIS folks because this “should just work”. I’ve also tried their Tiled Web Map Service and gotten back either black blocks or things that look like “torn” damaged images. Probably have to check whether it works with their examples; the closest client examples they have are for OpenLayers.

Thanks for your help!

I found some other docs that indicated a Web Mercator endpoint (wmts-webmerc), and I’ve been able to render properly against that. NASA says this endpoint is a few hours behind the ‘geographic’ endpoint, but that’s fine by me.

var viewer = new Cesium.CesiumWidget('cesiumContainer', {

    imageryProvider: new Cesium.WebMapTileServiceImageryProvider({

        url: 'http://map1.vis.earthdata.nasa.gov/wmts-webmerc/wmts.cgi',

        layer: 'MODIS_Terra_CorrectedReflectance_TrueColor',

        tileMatrixSetID: 'GoogleMapsCompatible_Level9',

        format: 'image/jpeg',

        style: '',

    })

});

And at this point in time (satellite hasn’t covered the “back side”, it looks like: