COG
Using Cloud Optimized GeoTIFF Files (COG) Examples.¶
We show how to read COG files with the rasterio Library for Python.
We will use the satsearch library for discovering and downloading publicly available satellite imagery using STAC compliant API.
STAC is the SpatioTemporal Assets Catalog specification that provides a common structure for describing and cataloging spatiotemporal assets.
A spatiotemporal asset is any file that represents information about the earth captured in a certain space and time.
References¶
- Abdishakur (2021) Cloud Optimized GeoTIFF (COG) with Python. Medium (Spatial Data Science).
- Andrew Cutts (2021). STAC, COG, Python and QGIS. acgeospatial Blog.
- Cloud Optimized GeoTIFF
- STAC - SpatioTemporal Assets Catalog.
In [ ]:
Copied!
# Install requirements
!pip install python-dateutil
# Install requirements
!pip install python-dateutil
In [ ]:
Copied!
# Install satsearch library
!pip install sat-search --quiet
# Please restart Runtime Environment after downloading
# Install satsearch library
!pip install sat-search --quiet
# Please restart Runtime Environment after downloading
In [ ]:
Copied!
# Install the rasterio library
!pip install rasterio --quiet
# Install the rasterio library
!pip install rasterio --quiet
In [4]:
Copied!
#!pip install gdalinfo
#!pip install gdalinfo
In [5]:
Copied!
# Import necessary libraries
from satsearch import Search
import rasterio as rio
from rasterio.plot import show
import matplotlib.pyplot as plt
# Import necessary libraries
from satsearch import Search
import rasterio as rio
from rasterio.plot import show
import matplotlib.pyplot as plt
Satsearch can take bounding boxes or GeoJSON like Polygon. So let us start with a simple bounding box. We are using the Element48 free Sentinel 2 data STAC API available in Amazon AWS for free, but you can use any public STAC API endpoint.