How to utilize STAC to load satellite images faster in web applications?

How to utilize STAC (SpatioTemporal Asset Catalog) to load satellite images faster in web application(2)

Spatineo was given an opportunity to participate in a project for Finnish Meteorological Institute (FMI) aiming to build a prototype catalog for Sentinel satellite images: FMI Sentinel catalog. The idea was to build a web based catalogue that would allow efficient and fast querying and downloading satellite images. In this case, the imagery is stored an AWS S3 compatible service.

The catalogue was built using Radian Earth Foundation’s STAC (SpatioTemporal Asset Catalog) specification. STAC contains specification, which aims to “increase the interoperability of searching for satellite imagery” and other geospatial assets. STAC allows data providers to produce a simple machine readable catalogues of imagery in a flexible and light data format. Data providers are able to add additional metadata and additional properties to the assets as they wish.

STAC implementation is formed of a STAC catalog and STAC items. A STAC item is a GeoJSON Feature containing additional fields including links to the assets. STAC items contains the geometry of the asset and can be used for example for selecting the correct satellite image from a map. STAC catalog is simple json that contains links to child STAC catalogs and/or STAC items. There are also STAC collections, which can be used to describe for example common properties of items without having to repeat the metadata on every item.

FMI Sentinel Catalogues Spatineo
FMI Sentinel Catalogue in action

In its simplest form, a STAC implementation can be a static catalog, which is basically set of json files on a server that link to one another and are therefore crawlable. The assets themselves can be on the same server or in another location, such as AWS S3 bucket or other HTTP server. The more tuned version is a catalog API, which is a RESTful API that is designed to mirror the static catalog.

You can read more about STAC specification here.

In this project the catalog was developed to follow STAC version 0.7.0 and it was built to be static catalog. In addition to specification, child link fields contain additional field: dimension. Dimension is used to specify whether the child catalog specifies certain geographic location (geohash) or date (time). This makes it easy for applications to understand the structure of the catalogue and to find sub-catalogues that contain items for the current view and time span.

FMI Sentinel catalog contains catalogs for Sentinel satellite images processed by FMI.  The somewhat simplified hierarchy of the catalog is:

  • root.json – root STAC catalog
    • dataset-S1.json – catalog for S1 images
      • dataset-S1-location-ug.json – catalog for S1 images in geohash ug
        • dataset-S1-location-ug-time-2017-08-01.json – catalog for S1 images for geohash ug and date 2017-08-01
          • 1_processed_20170801_15[…].json – STAC item for image
            • VH-asset.tif – Cloud optimized GeoTIFF asset (VH polarisation)
            • VV-asset.tif – Cloud optimized GeoTIFF asset (VV polarisation)
      • dataset-S1-location-uu.json
    • dataset-S3.json

In order to allow fast loading of remote sensing images in a web map framework, such as OpenLayers, the regular GeoTIFF images were processed to be cloud optimized GeoTIFFs (COGs). COG takes advantage of GeoTIFFs ability to organize pixels in particular ways and HTTP GET range requests that allow data to fetched within certain byte ranges. This fast loading of image in a certain zoom level and geographic extent.

  • With GDAL version above 3.1, you can do it whit
    gdalwarp src1.tif src2.tif out.tif -of COG
  • With lower GDAL versions, use
    gdal_translate src.tif out.tif -co TILED=YES -co COPY_SRC_OVERVIEWS=YES -co COMPRESS=LZW

If you are unsure whether your geoTIFF is cloud optimized or not, use this method to find out

By combining the simplicity and crawlability of STAC and speed of COGs it is possible to build easy-to-use (and -maintain) view and download services for satellite images. Go ahead and test FMI Sentinel catalog and other implementations of STAC catalogs. The code that produces the catalogue and the map application are also open source and available of github. In case you have further questions, don’t hesitate to shoot us a comment or an email!