# Add all the products into the STAC catalogforpathinpaths:logger.info(f"*** {os.path.basename(path)} ***")# Open the productprod=reader.open(path,remove_tmp=True)# Get itemitem=prod.stac.create_item()# Add item to cataloguecatalog.add_item(item)
2025-12-23 12:03:03,306 - [INFO] - *** LC08_L1TP_200030_20201220_20210310_02_T1.tar ***
'_vectorize' function is not lazy yet. Computing the raster.
2025-12-23 12:03:05,719 - [DEBUG] - Compute footprint for STAC Item for 20201220T104856_L8_200030_OLI_TIRS
2025-12-23 12:03:05,722 - [DEBUG] - Compute extent for STAC Item for 20201220T104856_L8_200030_OLI_TIRS
2025-12-23 12:03:05,724 - [DEBUG] - Creating STAC Item for 20201220T104856_L8_200030_OLI_TIRS
2025-12-23 12:03:05,725 - [DEBUG] - Add quicklook to STAC Item for 20201220T104856_L8_200030_OLI_TIRS
2025-12-23 12:03:05,726 - [WARNING] - No quicklook found in 20201220T104856_L8_200030_OLI_TIRS
2025-12-23 12:03:05,726 - [DEBUG] - Add EO extension to STAC Item for 20201220T104856_L8_200030_OLI_TIRS
2025-12-23 12:03:05,734 - [DEBUG] - Add PROJ extension to STAC Item for 20201220T104856_L8_200030_OLI_TIRS
2025-12-23 12:03:05,735 - [DEBUG] - Add VIEW extension to STAC Item for 20201220T104856_L8_200030_OLI_TIRS
2025-12-23 12:03:05,736 - [DEBUG] - Validate STAC Item for 20201220T104856_L8_200030_OLI_TIRS
2025-12-23 12:03:06,183 - [INFO] - *** LT05_L1TP_200030_20111110_20200820_02_T1.tar ***
'_vectorize' function is not lazy yet. Computing the raster.
2025-12-23 12:03:08,113 - [DEBUG] - Compute footprint for STAC Item for 20111110T103612_L5_200030_TM
2025-12-23 12:03:08,115 - [DEBUG] - Compute extent for STAC Item for 20111110T103612_L5_200030_TM
2025-12-23 12:03:08,116 - [DEBUG] - Creating STAC Item for 20111110T103612_L5_200030_TM
2025-12-23 12:03:08,117 - [DEBUG] - Add quicklook to STAC Item for 20111110T103612_L5_200030_TM
2025-12-23 12:03:08,117 - [DEBUG] - Add EO extension to STAC Item for 20111110T103612_L5_200030_TM
2025-12-23 12:03:08,122 - [DEBUG] - Add PROJ extension to STAC Item for 20111110T103612_L5_200030_TM
2025-12-23 12:03:08,122 - [DEBUG] - Add VIEW extension to STAC Item for 20111110T103612_L5_200030_TM
2025-12-23 12:03:08,122 - [DEBUG] - Validate STAC Item for 20111110T103612_L5_200030_TM
2025-12-23 12:03:08,146 - [INFO] - *** S2A_MSIL1C_20191215T110441_N0208_R094_T30TXP_20191215T114155.SAFE ***
2025-12-23 12:03:08,632 - [DEBUG] - Compute footprint for STAC Item for 20191215T110441_S2_T30TXP_L1C_114155
2025-12-23 12:03:08,634 - [DEBUG] - Compute extent for STAC Item for 20191215T110441_S2_T30TXP_L1C_114155
2025-12-23 12:03:08,635 - [DEBUG] - Creating STAC Item for 20191215T110441_S2_T30TXP_L1C_114155
2025-12-23 12:03:08,636 - [DEBUG] - Add quicklook to STAC Item for 20191215T110441_S2_T30TXP_L1C_114155
2025-12-23 12:03:08,756 - [DEBUG] - Add EO extension to STAC Item for 20191215T110441_S2_T30TXP_L1C_114155
2025-12-23 12:03:08,876 - [DEBUG] - Add PROJ extension to STAC Item for 20191215T110441_S2_T30TXP_L1C_114155
2025-12-23 12:03:08,876 - [DEBUG] - Add VIEW extension to STAC Item for 20191215T110441_S2_T30TXP_L1C_114155
2025-12-23 12:03:08,877 - [DEBUG] - Validate STAC Item for 20191215T110441_S2_T30TXP_L1C_114155
# Save catalogcatalog.describe()catalog.normalize_and_save(tmp.name,catalog_type=pystac.CatalogType.SELF_CONTAINED)
EODAG is an opensource python library that implements STAC and allows you to query your local STAC catalog.
Look at here for a detailed tutorial.
# Create an EODAG custom STAC providerdag=EODataAccessGateway()# Set EODAG logging level to WARNINGsetup_logging(verbose=1)# Add the custom STAC provider, exactly like in the tutorial mentioned abovedag.update_providers_config("""stac_http_provider: search: type: StaticStacSearch api_endpoint: %s products: GENERIC_PRODUCT_TYPE: productType: '{productType}' download: type: HTTPDownload base_uri: %s flatten_top_dirs: True outputs_prefix: %s"""%(catalog_path,tmp.name,tmp.name))# Set the custom STAC provider as preferreddag.set_preferred_provider("stac_http_provider")
# Query every product from inside the catalogall_products=dag.search()
# Load an AOIaoi_path=os.path.join("/home","aois","DAX.geojson")aoi=gpd.read_file(aoi_path)aoi_geojson=mapping(aoi.geometry.values[0])# Query spatially with the AOI and temporally with a time periodquery_args={"start":"2020-05-01","end":"2022-05-06","geom":aoi.geometry.values[0]}query_products=dag.search(**query_args)
We can use folium to display the results geometry over a map.
importfolium# Create a map zoomed over the search areafmap=folium.Map((43.2,-1.05),zoom_start=7)# Add a layer green layer for the query over the AOIfolium.GeoJson(data=all_products.as_geojson_object(),tooltip="All products stored in the catalog",style_function=lambdax:{'color':'green'}).add_to(fmap)# Add a layer green layer for the query over the AOIfolium.GeoJson(data=query_products.as_geojson_object(),tooltip="Retrieved products with the query",style_function=lambdax:{'color':'red'}).add_to(fmap)# Add a layer blue layer for the AOIfolium.GeoJson(data=aoi_geojson,tooltip="DAX AOI",style_function=lambdax:{'color':'blue'}).add_to(fmap)fmap
Make this Notebook Trusted to load map: File -> Trust Notebook