The Suomi National Polar-Orbiting Partnership (NPP) is one the newest U.S. Government satellites orbiting the earth, providing beautiful, open public domain imagery, thanks to U.S. taxpayers, and the U.S. Government’s commitment to open data and remote sensing research. Today, I used the VIIRS Nighttime Lights-2012 dataset, maintained by the Earth Observation Group, NOAA National Geophysical Data Center, to create a beautiful webmap showing lights visible at night from space.
The VIIRS Instrument collects visible and infrared imagery, across 22 different channels along the electromagnetic spectrum. There are many potential use cases for VIIRS imagery, including ocean, land, and atmospheric monitoring.
I’m going to go through how you can use VIIRS imagery with the open source geospatial library GDAL and TileMill to visualize nighttime lights visible from space.
VIIRS Nighttime Lights 2012 is a VIIRS derivative product created by compositing day/night bands from images captured between April 18-26, 2012, and October 11-23, 2012, on nights without moonlight. The dataset description goes into more detail about the level of processing, but a few important things to note are that the dataset has not had the background noise subtracted. The VIIRS day-night band detects lights, gas flares, auroras, and wildfires. It also detects reflected moonlight on some extremely bright surfaces, like snow-covered mountains.
Download GeoTIFFs from NOAA, which you can access via ftp at ftp://ftp.ngdc.noaa.gov/pub/outgoing/eog/viirs_ntl
Once you have the files downloaded, you’ll want to scale the downloaded GeoTiff, which comes with 32bit floating point values ranging from -1 to 50,000, to produce an 8 bit output GeoTiff. Because I was only interested in the areas in which the VIIRS sensor detected light, I used gdal_translate -scale 0 50 -ot Byte to take only those values falling between 1-50, and scaling them to 1 to 255 in the output raster.
Reproject to Google Mercator using gdalwarp
Add overviews to the reprojected GeoTIFF using gdaladdo
Next use gdalbuildvrt to generate three virtual rasters – one for each band of an RGB image. Since the Nighttime Lights dataset comes as a single-band grayscale GeoTIFF, I use virtual rasters to simulate the bands of a natural color RGB image.
Create a fourth virtual raster with the red, green, and blue VRTs generated in step 5
Modify the colors of each band, setting the <ColorInterp> tag, and adding look up tables using the <LUT> tag to the VRT XML
To optimize performance, generate a new GeoTIFF from the RGB-simulated VRT, and add overviews
Open in TileMill, style, and render
Upload to MapBox Hosting, and create a custom high-contrast MapBox Satellite layer base map.