top of page
  • Writer's pictureThiaggo Tayer

Are you still downloading satellite images? STOP and STAC Part 1

Updated: Mar 14

Learn to access satellite images with just a few lines of code without downloading it

Image: stacspec.org

Introduction

Recently, I was chatting with a friend who's new to the geospatial world. He was curious about my go-to sources for downloading satellite images. This got me thinking – are we still stuck in the era of downloading bulky image files? Let's face it: We often download more than we need, wasting time, storage and processing power on data we never use. Sometimes, we just need a long series of a small area, but the need to download full tiles makes this task cumbersome. Another example: How many times have you found your area of interest awkwardly split between two image tiles? These are familiar pain points for many of us, leading to unnecessary data pile-up. But here's the good news: there's a smarter way to access satellite imagery from any corner of the globe without the old hassles. Welcome to the world of cloud-native geospatial processing, a true game-changer in how we handle geospatial data. But first things first.

What is STAC?

STAC, short for SpatioTemporal Asset Catalog, is one of the specifications that simplifies the way we handle geospatial data (and that makes cloud-based geospatial analysis possible, besides Cloud Optimized GeoTiffs, but that's subject for another post). Think of STAC as a high-tech library catalogue tailored for satellite imagery and spatial data. Just as you'd search for a book by its title, subject, or author, STAC lets you find spatial data based on location, time, or the specific satellite. This sweet feature of STAC allows you to quickly pinpoint the exact data you need for a particular project or research.

But here's where it gets really cool: once you've found what you need using STAC's intuitive framework, you can either pull the data straight from the cloud onto your local drive with a few lines of code or even stream it directly into your favourite desktop GIS software, like ArcGIS or QGIS. It's like having a direct line to the exact satellite imagery you need without the fuss of downloading it.

Image: Wix.

How do you access satellite images using STAC?

The idea of accessing satellite imagery through STAC is beautifully simple. All you need is the URL of a STAC-compliant API. These APIs are your gateways to the satellite data you're after. You can find a variety of these 'doors' on STAC Specification or STAC Index pages. To interact with these APIs, you can use Python libraries like PySTAC. Here's a glimpse of how simple it is to start accessing data from, say, Digital Earth Australia (you can find all available products here):

With just these lines, you're in. Now, you need to set parameters like the boundaries of your study area (bbox), a specific time frame (start and end dates), and the satellite of interest (like Sentinel 2A and B). You then query the data based on these criteria, and voilà – the API returns a list of 'STAC Items’.

Inspecting STAC items

When we run our query, the output shows that we've got a list of 20 unique results, known as STAC Items. These aren't data packets yet; they're comprehensive indices combining detailed satellite metadata and the URL address for corresponding assets on the web. This means you get highly specific and relevant information for your project. But how do we dive into these? Since the STAC metadata is in GeoJSON format, we can easily navigate through it using nested Python dictionaries with the help of PySTAC.

Here's a quick peek into how you might inspect these items:

This code snippet walks you through how to access key properties of each STAC Item. It’s a straightforward way to get a snapshot of each item's content, like the satellite ID, image date, satellite platform, and item assets. This is very useful for automation; if you just want to have a look at all the item's properties, you can just explore them on Jupyter Notebooks, as shown below.

Inspecting STAC items on Jupyter.

Inspecting STAC assets

Within each STAC Item, you'll find multiple assets. These assets are essentially the building blocks of your satellite data, representing unique data files or layers, such as individual remote sensing bands, cloud coverage/masks, solar azimuth, etc. You can check its properties the same way we did with STAC items.

Inspecting assets is especially useful if you're looking to analyze specific aspects of an area, like vegetation health or water bodies, where certain bands like near-infrared or red edge are key. This is also how you will discover the exact name of the assets that you can further access and process.

Visualizing the extent of the queried items

Now that we have inspected our STAC items and assets, let’s add some spatial magic. Remember, STAC metadata is stored in GeoJSON format, so we can easily convert it to a spatial object using the Geopandas Python package. This allows us to plot and inspect the spatial extents and attributes of our data more intuitively. Here’s a quick look at how you might use Geopandas for this:

Extent of the queried STAC items.

Conclusion

In this article, we've taken the first steps towards cloud-based geospatial analysis and STAC. We've delved into the basics, examined how to query and inspect STAC items and assets, and even visualized footprints using Geopandas. This journey has set the foundation for more advanced explorations. In the upcoming articles of this series, we will dive even deeper.

It's important to highlight that STACs are not only for accessing data on the cloud but also for organizing local geospatial data and assets, such as subproducts from a specific project. To learn how to create an STAC catalogue from scratch, check out this post: Organizing Geospatial data with Spatio Temporal Assets Catalogs — STAC using python.

So, stay tuned for more practical, hands-on guidance in this exciting area of geospatial technology. See you then!

As per usual, here is the full code for this article:


1,155 views2 comments

2 Comments


Rumi
Rumi
May 08

Hats off to you for elucidating this STAC concept. One of my fav posts ! required almost no assumptions from the reader! Thanks again!

Like
geocorneradm
geocorneradm
Jun 07
Replying to

Dear Rumi, thank you for your comments!!! Stay tuned for more posts like this... :)

Like
bottom of page