Wednesday, September 03, 2014

satellite images of earth.

For a while now, I've wanted a desktop background like xearth, but with updated (near-live) imagery. I've found a bunch of services that won't give me exactly that, but something I can live with.

Near Real-Time Data: Rapid Response has imagery from a bunch of instruments in satellites. I've had good experience with the Aqua MODIS images. Two tools on that site that I've tried are LANCE and Worldview.

Worldview shows the entire (mapped) planet with a short delay (they say 2.5-3 hours after a satellite pass). You can select base layers from the Aqua or Terra MODIS sources, and overlays from OpenStreetMap for borders, coastlines, and place names. You can also select a date to see what the world looked like in the past, going as far back as May 8, 2012. The best thing about it is that you can click on the camera icon, select an area, and it'll give you a link to an image. The image resolution goes down to 250 meters per pixel.

The Worldview image links appear to be stable, and look like

http://map2.vis.earthdata.nasa.gov/imagegen/index.php?TIME=2014246&extent=32.481445312501,23.405273437501,33.116455078126,24.152343750001&epsg=4326&layers=MODIS_Terra_CorrectedReflectance_TrueColor,Reference_Features,Reference_Labels&format=image/jpeg&width=289&height=340

The TIME field is the current year followed by the day of the year (September 3 is the 246th day). Incrementing this field should get you the next day's image; you can easily write a script to generate a desktop background once a day, or fetch a bunch of files and generate an animation.

Image subsets are also available of the MODIS data for certain areas of the world. Selecting South America brings up a page where I can select, say, True Color images of La Paz and the surrounding area. It's the same data as Worldview, but with a different interface. It gives you a JPEG download link that, again, appears to be stable; it looks like

http://lance-modis.eosdis.nasa.gov/imagery/subsets/?subset=AERONET_La_Paz.2014246.terra.250m.zip

Another way to grab imagery is with GDAL. The subset image page has a link that describes how to download the data using GDAL. In summary, you create a file that looks like


    <gdal_wms>
      <service name="TMS">
        <serverurl>http://map1.vis.earthdata.nasa.gov/wmts-geo/MODIS_Terra_CorrectedReflectance_TrueColor/default/2014-09-03/EPSG4326_250m/${z}/${y}/${x}.jpg</serverurl>
      </service>
      <datawindow>
        <upperleftx>-180.0</upperleftx>
        <upperlefty>90</upperlefty>
        <lowerrightx>396.0</lowerrightx>
        <lowerrighty>-198</lowerrighty>
        <tilelevel>8</tilelevel>
        <tilecountx>2</tilecountx>
        <tilecounty>1</tilecounty>
        <yorigin>top</yorigin>
      </datawindow>
      <projection>EPSG:4326</projection>
      <blocksizex>512</blocksizex>
      <blocksizey>512</blocksizey>
      <bandscount>3</bandscount>
    </gdal_wms>

Install the gdal tools (Ubuntu: apt-get install gdal-bin), and type

gdal_translate -of GTiff -outsize 3840 2880 \
    -projwin -72.44865700501 -13.302075710262 -63.681994009835 -19.777183974533 \
    your-gdal-filename.xml AERONET_La_Paz.tif
gdal_translate -of JPEG AERONET_La_Paz.tif AERONET_La_Paz.jpg

Change MODIS_Terra_CorrectedReflectance_TrueColor to MODIS_Aqua_CorrectedReflectance_TrueColor for the Aqua images. I used Worldview to figure out a bounding box for my city, and modified the -projwin parameter to match (and also -outsize to match my display resolution), and voila! a desktop background!

No comments: