Nasa Earth Imagery API

I recently read on Hacker News about NASA releasing/opening a set of APIs which offer up access to a wealth of datasets gathered other the years.

I looked at the different datasets and decided to try to work with the Earth Imagery API which contains images taken from space by the LandSat 8 satellite. Nasa state that the satellite may pass a set location up to once very 16 days and provide a 'fly by' type service which for a given latitude and longitude can give a list of all dates where an image is available.
We can then use that list of dates to request individual thumbnails and a zoom or scale factor.

My code is available as a 'gist' on GitHub with some minimal comments.

Why don't you try downloading the code and pasting in an interesting location such as the Chernobyl exclusion zone, where it's possible to see a new bright metal object being placed over the old reactor shelter? See what happens when you change the tileDimension variable to set the scale and zoom.

Chernobyl at 1.25 scale

Scaled at 1.25

Chernobyl at 0.35 scale

Scaled at 0.35

The node.js code

Things I learnt

Things I learnt about or tried with this coding session:

  • request library for pulling .jpg images
  • async library for both sequencing my request of thumbnail URLs from the service
  • async service for queuing .jpg download requests in batches of 5 - so that we do not throttle our connection
  • I applied for a generic US data API key, which has a limit of 1000 requests per hour. That soon got used up in debugging so I introduced a 'cap' variable.
  • The demo API key is useful for 50 requests per hour

Let me know what you think in the comments.

Alex Ellis

Read more posts by this author.

Subscribe to Alex Ellis' Blog

Subscribe to keep in touch. By providing your email, you agree to receive marketing emails from OpenFaaS Ltd

or subscribe via RSS with your favourite RSS reader

Learn Go with my new eBook

eBook cover

"Everyday Go" is the fast way to learn tools, techniques and patterns from real tools used in production based upon my experience of building and running OpenFaaS at scale.

Buy a copy on Gumroad