2

QGIS Version: 2.18.3

I am trying to add some basemaps layers from NASA's GIBS API, but I cannot seem to get the URL right to connect to it.

According to the site, I think I should just be able to use the REST endpoint at https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/ Under "Add Layers from a WM(T)S Server" in QGIS. When I do this, however it is not recognized as a WMS server, because I get the error "The server you are trying to connect to does not seem to be a WMS server. Please check the URL.".

If I try the GetCapabilities link at https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/1.0.0/WMTSCapabilities.xml, then I do get a list of services to choose from, but the map canvas is blank when I try to add anything.

The Layer Properties then shows this under the General > Layer Source tab:

contextualWMSLegend=0&crs=EPSG:4326&dpiMode=7&featureCount=10&format=image/png&layers=VIIRS_Night_Lights&styles=default&tileDimensions=time%3D2016-01-01/2016-01-01/P1Y&tileMatrixSet=500m&url=https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/1.0.0/WMTSCapabilities.xml

Specifically I am trying to add the "Night Lights" layer.

  • is the dpimode really 7? – nmtoken May 14 '18 at 13:07
  • How about the TileLayer plugin? QGIS 2.18 not 3. – nielsgerrits May 14 '18 at 13:35
2

As an alternative you could use the Generic XYZ Tiles as documented.

QGIS 3.x

  • Open Browser
  • Right Click Tile Server (XYZ)
  • Click "New connection..."
  • Enter Name, Url and set zoomlevels.
  • Click "OK".
  • Double click on the new layer to add to map.

QGIS 2.x

  • Open "Browser Panel"
  • Right click "Tile Server (XYZ)"
  • Click "New connection..."
  • Insert XYZ tile layer URL, click "OK".
  • Enter name, click "OK".
  • Double click on the new layer to add to map.

You need to study the GetCapabilities a bit for the exact parameters but I worked some out:

VIIRS_Night_Lights https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_Night_Lights/default/default/GoogleMapsCompatible_Level8/{z}/{y}/{x}.png

VIIRS_Black_Marble: https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_Black_Marble/default/default/GoogleMapsCompatible_Level8/{z}/{y}/{x}.png

The syntax is: https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_Black_Marble/default/Dimension/TileMatrixSet/{z}/{y}/{x}.png

You need to look up the Dimension:

...
<Dimension>
  <ows:Identifier>time</ows:Identifier>
  <ows:UOM>ISO8601</ows:UOM>
  <Default>2016-01-01</Default>
  <Current>false</Current>
  <Value>2012-01-01/2012-01-01/P1Y</Value>
  <Value>2016-01-01/2016-01-01/P1Y</Value>
</Dimension>
...

And the TileMatrixSet:

...
<TileMatrixSetLink>
  <TileMatrixSet>GoogleMapsCompatible_Level8</TileMatrixSet>
</TileMatrixSetLink>
...

Setting Dimension to Default will result in the most recent set available.

QGIS 3 with VIIRS_Black_Marble layer

  • I tried to put that in a file called "gibs.tsv" and then went into "Settings" and set the folder that it is located in as the External layer definition directory, but no entries under "gibs" appear, did I miss a step somewhere? – wfgeo May 14 '18 at 14:05
  • @1saac I redid my answer, you don't need the TileLayer plugin anymore as TileLayers are standard in QGIS nowadays. – nielsgerrits May 15 '18 at 5:20
  • This is great, thanks. I ended up having to take a much more manual approach, as I was hoping to be able to query the brightness values at individual pixels and summarize them, but this definitely answers my question and gives me enough info to automate scraping tiles – wfgeo May 15 '18 at 15:24
2

I can get some of the layers from this server to work as WMTS layers in QGIS, however some don't seem to work. These seem to be the ones which have a time variable in the WMTS template URL. It seems that QGIS doesn't recognise this and leaves it out of the request.

A quick Google turns up this known bug.

  • That's frustrating. Would there be a way to just download some of the tiles manually and add them as a raster layer? – wfgeo May 14 '18 at 13:18

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.