Quantcast
Channel: maps for developers - Medium
Viewing all articles
Browse latest Browse all 2294

Pansharpening Satellite Imagery for Easier Tracing into OpenStreetMap

$
0
0

GeoEye and the Humanitarian OpenStreetMap Team (HOT) are collaborating to trace new satellite imagery of Salajar Island, Indonesia, an under-mapped area in OpenStreetMap. This is part of HOT’s larger work in Indonesia organizing workshops, competitions, and mapping events to provide detailed OSM maps for use by disaster first-responders and policymakers to aid in the country’s emergency preparedness efforts. To help HOT’s tracing efforts we processed imagery for Salajar Island from the GeoEye-1 satellite, which captures panchromatic (black and white) images at a resolution of 0.5 meters per pixel, and multispectral imagery (red, green, blue and near infrared) at a spatial resolution of 1.65 meters. A key step in our data processing was pansharpening, which merges the lower-resolution color image with the higher-resolution panchromatic one.

Here is a walk through of how we used open source geospatial libraries to turn GeoEye’s raw source imagery into a webmap rendered in TileMill and available through MapBox, which HOT’s team will use in its tracing efforts. Check out our final map of Salajar Island, and stay tuned for more information on a micro-site from GeoEye to facilitate the process and tracing results from HOT.

Pansharpening satellite images for better clarity

One way to take advantage of the higher resolution panchromatic image is to use it to pansharpen the lower resolution multispectral images, which generates a natural color RGB image with the spatial resolution of the panchromatic image.

Orfeo Toolbox is an open source, geospatially enabled image processing library developed at the French Space Agency that supports satellite sensor calibration and raster operations not available in GDAL. Orfeo Toolbox also has good support for several image fusion functions.

The BundleToPerfectSensor application, distributed as part of the OTB Applications, performs the two steps necessary to perform the pansharpening: image registration and pixel fusion.

The main steps involved in the pansharpening are:

  1. Create a natural color Virtual Raster (VRT) from the original red, green, and blue bands, which are separate geotiffs.
  2. Assign the correct color interpretation value for each band added to the virtual raster.
  3. Pansharpen the RGB virtual raster using the original panchromatic image, being careful to maintain the data type from before (UInt16)
  4. Convert and scale pansharpened RGB image from UInt16 to Byte.
  5. Warp the pansharpened RGB image from it’s native projection to Google Mercator (EPSG:3785)
  6. Add overviews to the reprojected pansharpened RGB GeoTIFF.

Here’s what the code looks like:

DIR="" #change to the directory containing the GeoEye imagery
ADDO="2 4 8 16 32 64 128 256 512 1024 2048 4096 8192"
gdalbuildvrt \
  -separate \
  -q \
  -srcnodata "0 0 0"\
  -vrtnodata "0 0 0"\
  $DIR/rgb.vrt \
  $DIR/*red*.tif $DIR/*grn*.tif  $DIR/*blu*.tif && \
sed -i '6 i\
<ColorInterp>Red</ColorInterp>' $DIR/rgb.vrt && \
sed -i '18  i\
<ColorInterp>Green</ColorInterp>' $DIR/rgb.vrt && \
sed -i '30 i\
<ColorInterp>Blue</ColorInterp>' $DIR/rgb.vrt && \
otbcli_BundleToPerfectSensor \
  -ram 4096 \
  -inp $DIR/*_pan_*.tif \
  -inxs $DIR/rgb.vrt \
  -out $DIR/pan-${DIR}.tif uint16 && \
gdal_translate \
   -ot Byte \
   -scale 0 3000 0 255 \
   -a_nodata "0 0 0" \
   $DIR/pan-${DIR}.tif $DIR/pan-${DIR}-scaled.tif && \
gdalwarp \
  -r cubic \
  -wm 4096 \
  -multi \
  -srcnodata "0 0 0" \
  -dstnodata "0 0 0" \
  -dstalpha \
  -wo OPTIMIZE_SIZE=TRUE \
  -wo UNIFIED_SRC_NODATA=YES \
  -t_srs EPSG:3785 \
  -co TILED=YES\
  -co COMPRESS=LZW\
  $DIR/pan-${DIR}-scaled.tif $DIR/pansharp_${DIR}_3785.tif &&\
gdaladdo \
  -r cubic \
  --config COMPRESS_OVERVIEW LZW \
  $DIR/pansharp_${DIR}_3785.tif $ADDO && \
rm $DIR/pan-${DIR}.tif ${DIR}/pan-${DIR}-scaled.tif

Before Pansharpening

Salajar Island, Before Pansharpening

After Pansharpening

Salajar Island, After Pansharpening


Viewing all articles
Browse latest Browse all 2294

Trending Articles