1.1.2 • Published 3 years ago
gibs-leaflet v1.1.2
gibs-leaflet
Javascript component to integrate NASA EOSDIS GIBS (Global Imagery Browse Services) satellite imagery with Leaflet maps.
Based on aparshin/leaflet-GIBS, and repacked to be used as a NPM module.
Compatible with Leaflet versions > 1.x.x.
Installation
npm install --save gibs-leaflet
Usage
import L from 'leaflet';
import GIBSLeaflet from 'gibs-leaflet';
const mapWithGIBSLayers = GIBSLeaflet.wrap(L);
Adding layers
You can add to your Leaflet map as many GIBS layers as you wish, as follows:
- after you have defined a base layer, add it to the map
mapWithGIBSLayers.addLayer(baseLayer);
- define additional layers, one for each GIBS layer you want to be appliable to the map
const layer1 = new L.GIBSLayer('GMI_Snow_Rate_Asc', {
date: new Date('2018/11/15'),
transparent: true
});
// more layers
- create an object that contains all your layers - the name you choose as the key for each layer will be the one visible on the switcher to select the corresponding layer
const layers = {
'Snow rate' : layer1,
// more layers
}
- create a layer control and add it to the map
L.control.layers(layers).addTo(mapWithGIBSLayers);
Available layers
Layers Metadata
The metadata for available GIBS layers is defined in the file data.js
as L.GIBS_LAYERS
. Keys are layer's IDs, values are the following objects:
title
- layer's titletemplate
- template of layer tileszoom
- max zoom of the layerdate
(boolean) - is the layer multi-temporal
Available options
The following options can be set:
Option | Type | Description |
---|---|---|
date | Date | Date for multi-temporal products |
transparent | Boolean | Make no-data pixels of MODIS Multiband Imagery transparent |
Data
The layer data source used is this xml - last update done on 4/02/2019
Tests
You can test which layers are functioning/broken running
npm test