PySTAC-Client Introduction#
This notebook shows basic use of pystac-client to open an API, iterate through Collections and Items, and perform simple spatio-temporal searches.
[1]:
from pystac_client import Client
# set pystac_client logger to DEBUG to see API calls
import logging
logging.basicConfig()
logger = logging.getLogger('pystac_client')
logger.setLevel(logging.DEBUG)
Client#
We first connect to an API by retrieving the root catalog, or landing page, of the API with the Client.open
function.
[2]:
# STAC API root URL
URL = 'https://planetarycomputer.microsoft.com/api/stac/v1'
# custom headers
headers = []
cat = Client.open(URL, headers=headers)
cat
DEBUG:pystac_client.stac_api_io:GET https://planetarycomputer.microsoft.com/api/stac/v1 Headers: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'}
[2]:
- type "Catalog"
- id "microsoft-pc"
- stac_version "1.0.0"
- description "Searchable spatiotemporal metadata describing Earth science datasets hosted by the Microsoft Planetary Computer"
links [] 131 items
0
- rel "self"
- href "https://planetarycomputer.microsoft.com/api/stac/v1"
- type "application/json"
1
- rel "root"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/"
- type "application/json"
2
- rel "data"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections"
- type "application/json"
3
- rel "conformance"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/conformance"
- type "application/json"
- title "STAC/WFS3 conformance classes implemented by this server"
4
- rel "search"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/search"
- type "application/geo+json"
- title "STAC search"
- method "GET"
5
- rel "search"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/search"
- type "application/geo+json"
- title "STAC search"
- method "POST"
6
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/daymet-annual-pr"
- type "application/json"
- title "Daymet Annual Puerto Rico"
7
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/daymet-daily-hi"
- type "application/json"
- title "Daymet Daily Hawaii"
8
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/3dep-seamless"
- type "application/json"
- title "USGS 3DEP Seamless DEMs"
9
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/3dep-lidar-dsm"
- type "application/json"
- title "USGS 3DEP Lidar Digital Surface Model"
10
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/fia"
- type "application/json"
- title "Forest Inventory and Analysis"
11
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-1-rtc"
- type "application/json"
- title "Sentinel 1 Radiometrically Terrain Corrected (RTC)"
12
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/gridmet"
- type "application/json"
- title "gridMET"
13
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/daymet-annual-na"
- type "application/json"
- title "Daymet Annual North America"
14
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/daymet-monthly-na"
- type "application/json"
- title "Daymet Monthly North America"
15
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/daymet-annual-hi"
- type "application/json"
- title "Daymet Annual Hawaii"
16
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/daymet-monthly-hi"
- type "application/json"
- title "Daymet Monthly Hawaii"
17
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/daymet-monthly-pr"
- type "application/json"
- title "Daymet Monthly Puerto Rico"
18
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/gnatsgo-tables"
- type "application/json"
- title "gNATSGO Soil Database - Tables"
19
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/hgb"
- type "application/json"
- title "HGB: Harmonized Global Biomass for 2010"
20
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/cop-dem-glo-30"
- type "application/json"
- title "Copernicus DEM GLO-30"
21
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/cop-dem-glo-90"
- type "application/json"
- title "Copernicus DEM GLO-90"
22
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/goes-cmi"
- type "application/json"
- title "GOES-R Cloud & Moisture Imagery"
23
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/terraclimate"
- type "application/json"
- title "TerraClimate"
24
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/nasa-nex-gddp-cmip6"
- type "application/json"
- title "Earth Exchange Global Daily Downscaled Projections (NEX-GDDP-CMIP6)"
25
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/gpm-imerg-hhr"
- type "application/json"
- title "GPM IMERG"
26
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/gnatsgo-rasters"
- type "application/json"
- title "gNATSGO Soil Database - Rasters"
27
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/3dep-lidar-hag"
- type "application/json"
- title "USGS 3DEP Lidar Height above Ground"
28
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/io-lulc-annual-v02"
- type "application/json"
- title "10m Annual Land Use Land Cover (9-class) V2"
29
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/3dep-lidar-intensity"
- type "application/json"
- title "USGS 3DEP Lidar Intensity"
30
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/3dep-lidar-pointsourceid"
- type "application/json"
- title "USGS 3DEP Lidar Point Source"
31
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/mtbs"
- type "application/json"
- title "MTBS: Monitoring Trends in Burn Severity"
32
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-c-cap"
- type "application/json"
- title "C-CAP Regional Land Cover and Change"
33
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/3dep-lidar-copc"
- type "application/json"
- title "USGS 3DEP Lidar Point Cloud"
34
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-64A1-061"
- type "application/json"
- title "MODIS Burned Area Monthly"
35
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/alos-fnf-mosaic"
- type "application/json"
- title "ALOS Forest/Non-Forest Annual Mosaic"
36
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/3dep-lidar-returns"
- type "application/json"
- title "USGS 3DEP Lidar Returns"
37
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/mobi"
- type "application/json"
- title "MoBI: Map of Biodiversity Importance"
38
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/landsat-c2-l2"
- type "application/json"
- title "Landsat Collection 2 Level-2"
39
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/era5-pds"
- type "application/json"
- title "ERA5 - PDS"
40
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/chloris-biomass"
- type "application/json"
- title "Chloris Biomass"
41
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/kaza-hydroforecast"
- type "application/json"
- title "HydroForecast - Kwando & Upper Zambezi Rivers"
42
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/planet-nicfi-analytic"
- type "application/json"
- title "Planet-NICFI Basemaps (Analytic)"
43
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-17A2H-061"
- type "application/json"
- title "MODIS Gross Primary Productivity 8-Day"
44
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-11A2-061"
- type "application/json"
- title "MODIS Land Surface Temperature/Emissivity 8-Day"
45
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/daymet-daily-pr"
- type "application/json"
- title "Daymet Daily Puerto Rico"
46
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/3dep-lidar-dtm-native"
- type "application/json"
- title "USGS 3DEP Lidar Digital Terrain Model (Native)"
47
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/3dep-lidar-classification"
- type "application/json"
- title "USGS 3DEP Lidar Classification"
48
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/3dep-lidar-dtm"
- type "application/json"
- title "USGS 3DEP Lidar Digital Terrain Model"
49
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/gap"
- type "application/json"
- title "USGS Gap Land Cover"
50
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-17A2HGF-061"
- type "application/json"
- title "MODIS Gross Primary Productivity 8-Day Gap-Filled"
51
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/planet-nicfi-visual"
- type "application/json"
- title "Planet-NICFI Basemaps (Visual)"
52
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/gbif"
- type "application/json"
- title "Global Biodiversity Information Facility (GBIF)"
53
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-17A3HGF-061"
- type "application/json"
- title "MODIS Net Primary Production Yearly Gap-Filled"
54
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-09A1-061"
- type "application/json"
- title "MODIS Surface Reflectance 8-Day (500m)"
55
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/alos-dem"
- type "application/json"
- title "ALOS World 3D-30m"
56
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/alos-palsar-mosaic"
- type "application/json"
- title "ALOS PALSAR Annual Mosaic"
57
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/deltares-water-availability"
- type "application/json"
- title "Deltares Global Water Availability"
58
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-16A3GF-061"
- type "application/json"
- title "MODIS Net Evapotranspiration Yearly Gap-Filled"
59
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-21A2-061"
- type "application/json"
- title "MODIS Land Surface Temperature/3-Band Emissivity 8-Day"
60
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/us-census"
- type "application/json"
- title "US Census"
61
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/jrc-gsw"
- type "application/json"
- title "JRC Global Surface Water"
62
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/deltares-floods"
- type "application/json"
- title "Deltares Global Flood Maps"
63
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-43A4-061"
- type "application/json"
- title "MODIS Nadir BRDF-Adjusted Reflectance (NBAR) Daily"
64
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-09Q1-061"
- type "application/json"
- title "MODIS Surface Reflectance 8-Day (250m)"
65
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-14A1-061"
- type "application/json"
- title "MODIS Thermal Anomalies/Fire Daily"
66
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/hrea"
- type "application/json"
- title "HREA: High Resolution Electricity Access"
67
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-13Q1-061"
- type "application/json"
- title "MODIS Vegetation Indices 16-Day (250m)"
68
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-14A2-061"
- type "application/json"
- title "MODIS Thermal Anomalies/Fire 8-Day"
69
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-2-l2a"
- type "application/json"
- title "Sentinel-2 Level-2A"
70
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-15A2H-061"
- type "application/json"
- title "MODIS Leaf Area Index/FPAR 8-Day"
71
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-11A1-061"
- type "application/json"
- title "MODIS Land Surface Temperature/Emissivity Daily"
72
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-15A3H-061"
- type "application/json"
- title "MODIS Leaf Area Index/FPAR 4-Day"
73
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-13A1-061"
- type "application/json"
- title "MODIS Vegetation Indices 16-Day (500m)"
74
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/daymet-daily-na"
- type "application/json"
- title "Daymet Daily North America"
75
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/nrcan-landcover"
- type "application/json"
- title "Land Cover of Canada"
76
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-10A2-061"
- type "application/json"
- title "MODIS Snow Cover 8-day"
77
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/ecmwf-forecast"
- type "application/json"
- title "ECMWF Open Data (real-time)"
78
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-mrms-qpe-24h-pass2"
- type "application/json"
- title "NOAA MRMS QPE 24-Hour Pass 2"
79
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-1-grd"
- type "application/json"
- title "Sentinel 1 Level-1 Ground Range Detected (GRD)"
80
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/nasadem"
- type "application/json"
- title "NASADEM HGT v001"
81
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/io-lulc"
- type "application/json"
- title "Esri 10-Meter Land Cover (10-class)"
82
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/landsat-c2-l1"
- type "application/json"
- title "Landsat Collection 2 Level-1"
83
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/drcog-lulc"
- type "application/json"
- title "Denver Regional Council of Governments Land Use Land Cover"
84
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/chesapeake-lc-7"
- type "application/json"
- title "Chesapeake Land Cover (7-class)"
85
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/chesapeake-lc-13"
- type "application/json"
- title "Chesapeake Land Cover (13-class)"
86
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/chesapeake-lu"
- type "application/json"
- title "Chesapeake Land Use"
87
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-mrms-qpe-1h-pass1"
- type "application/json"
- title "NOAA MRMS QPE 1-Hour Pass 1"
88
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-mrms-qpe-1h-pass2"
- type "application/json"
- title "NOAA MRMS QPE 1-Hour Pass 2"
89
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-nclimgrid-monthly"
- type "application/json"
- title "Monthly NOAA U.S. Climate Gridded Dataset (NClimGrid)"
90
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/goes-glm"
- type "application/json"
- title "GOES-R Lightning Detection"
91
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/usda-cdl"
- type "application/json"
- title "USDA Cropland Data Layers (CDLs)"
92
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/eclipse"
- type "application/json"
- title "Urban Innovation Eclipse Sensor Data"
93
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/esa-cci-lc"
- type "application/json"
- title "ESA Climate Change Initiative Land Cover Maps (Cloud Optimized GeoTIFF)"
94
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/esa-cci-lc-netcdf"
- type "application/json"
- title "ESA Climate Change Initiative Land Cover Maps (NetCDF)"
95
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/fws-nwi"
- type "application/json"
- title "FWS National Wetlands Inventory"
96
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/usgs-lcmap-conus-v13"
- type "application/json"
- title "USGS LCMAP CONUS Collection 1.3"
97
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/usgs-lcmap-hawaii-v10"
- type "application/json"
- title "USGS LCMAP Hawaii Collection 1.0"
98
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-climate-normals-tabular"
- type "application/json"
- title "NOAA US Tabular Climate Normals"
99
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-climate-normals-netcdf"
- type "application/json"
- title "NOAA US Gridded Climate Normals (NetCDF)"
100
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-climate-normals-gridded"
- type "application/json"
- title "NOAA US Gridded Climate Normals (Cloud-Optimized GeoTIFF)"
101
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/aster-l1t"
- type "application/json"
- title "ASTER L1T"
102
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/cil-gdpcir-cc-by-sa"
- type "application/json"
- title "CIL Global Downscaled Projections for Climate Impacts Research (CC-BY-SA-4.0)"
103
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/naip"
- type "application/json"
- title "NAIP: National Agriculture Imagery Program"
104
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/io-lulc-9-class"
- type "application/json"
- title "10m Annual Land Use Land Cover (9-class) V1"
105
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/io-biodiversity"
- type "application/json"
- title "Biodiversity Intactness"
106
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-cdr-sea-surface-temperature-whoi"
- type "application/json"
- title "Sea Surface Temperature - WHOI CDR"
107
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-cdr-ocean-heat-content"
- type "application/json"
- title "Global Ocean Heat Content CDR"
108
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/cil-gdpcir-cc0"
- type "application/json"
- title "CIL Global Downscaled Projections for Climate Impacts Research (CC0-1.0)"
109
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/cil-gdpcir-cc-by"
- type "application/json"
- title "CIL Global Downscaled Projections for Climate Impacts Research (CC-BY-4.0)"
110
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-cdr-sea-surface-temperature-whoi-netcdf"
- type "application/json"
- title "Sea Surface Temperature - WHOI CDR NetCDFs"
111
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-cdr-sea-surface-temperature-optimum-interpolation"
- type "application/json"
- title "Sea Surface Temperature - Optimum Interpolation CDR"
112
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/modis-10A1-061"
- type "application/json"
- title "MODIS Snow Cover Daily"
113
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-5p-l2-netcdf"
- type "application/json"
- title "Sentinel-5P Level-2"
114
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-olci-wfr-l2-netcdf"
- type "application/json"
- title "Sentinel-3 Water (Full Resolution)"
115
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/noaa-cdr-ocean-heat-content-netcdf"
- type "application/json"
- title "Global Ocean Heat Content CDR NetCDFs"
116
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-synergy-aod-l2-netcdf"
- type "application/json"
- title "Sentinel-3 Global Aerosol"
117
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-synergy-v10-l2-netcdf"
- type "application/json"
- title "Sentinel-3 10-Day Surface Reflectance and NDVI (SPOT VEGETATION)"
118
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-olci-lfr-l2-netcdf"
- type "application/json"
- title "Sentinel-3 Land (Full Resolution)"
119
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-sral-lan-l2-netcdf"
- type "application/json"
- title "Sentinel-3 Land Radar Altimetry"
120
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-slstr-lst-l2-netcdf"
- type "application/json"
- title "Sentinel-3 Land Surface Temperature"
121
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-slstr-wst-l2-netcdf"
- type "application/json"
- title "Sentinel-3 Sea Surface Temperature"
122
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-sral-wat-l2-netcdf"
- type "application/json"
- title "Sentinel-3 Ocean Radar Altimetry"
123
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/ms-buildings"
- type "application/json"
- title "Microsoft Building Footprints"
124
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-slstr-frp-l2-netcdf"
- type "application/json"
- title "Sentinel-3 Fire Radiative Power"
125
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-synergy-syn-l2-netcdf"
- type "application/json"
- title "Sentinel-3 Land Surface Reflectance and Aerosol"
126
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-synergy-vgp-l2-netcdf"
- type "application/json"
- title "Sentinel-3 Top of Atmosphere Reflectance (SPOT VEGETATION)"
127
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-3-synergy-vg1-l2-netcdf"
- type "application/json"
- title "Sentinel-3 1-Day Surface Reflectance and NDVI (SPOT VEGETATION)"
128
- rel "child"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/esa-worldcover"
- type "application/json"
- title "ESA WorldCover"
129
- rel "service-desc"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/openapi.json"
- type "application/vnd.oai.openapi+json;version=3.0"
- title "OpenAPI service description"
130
- rel "service-doc"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/docs"
- type "text/html"
- title "OpenAPI service documentation"
conformsTo [] 15 items
- 0 "http://www.opengis.net/spec/cql2/1.0/conf/basic-cql2"
- 1 "http://www.opengis.net/spec/cql2/1.0/conf/cql2-json"
- 2 "http://www.opengis.net/spec/cql2/1.0/conf/cql2-text"
- 3 "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core"
- 4 "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson"
- 5 "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/oas30"
- 6 "http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/filter"
- 7 "https://api.stacspec.org/v1.0.0-rc.1/collections"
- 8 "https://api.stacspec.org/v1.0.0-rc.1/core"
- 9 "https://api.stacspec.org/v1.0.0-rc.1/item-search"
- 10 "https://api.stacspec.org/v1.0.0-rc.1/item-search#fields"
- 11 "https://api.stacspec.org/v1.0.0-rc.1/item-search#filter"
- 12 "https://api.stacspec.org/v1.0.0-rc.1/item-search#query"
- 13 "https://api.stacspec.org/v1.0.0-rc.1/item-search#sort"
- 14 "https://api.stacspec.org/v1.0.0-rc.1/ogcapi-features"
- title "Microsoft Planetary Computer STAC API"
CollectionClient#
As with a static catalog the get_collections
function will iterate through the Collections in the Catalog. Notice that because this is an API it can get all the Collections through a single call, rather than having to fetch each one individually.
[3]:
for collection in cat.get_collections():
print(collection)
DEBUG:pystac_client.stac_api_io:GET https://planetarycomputer.microsoft.com/api/stac/v1/ Headers: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'}
DEBUG:pystac_client.stac_api_io:GET https://planetarycomputer.microsoft.com/api/stac/v1/collections Headers: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'}
<CollectionClient id=daymet-annual-pr>
<CollectionClient id=daymet-daily-hi>
<CollectionClient id=3dep-seamless>
<CollectionClient id=3dep-lidar-dsm>
<CollectionClient id=fia>
<CollectionClient id=sentinel-1-rtc>
<CollectionClient id=gridmet>
<CollectionClient id=daymet-annual-na>
<CollectionClient id=daymet-monthly-na>
<CollectionClient id=daymet-annual-hi>
<CollectionClient id=daymet-monthly-hi>
<CollectionClient id=daymet-monthly-pr>
<CollectionClient id=gnatsgo-tables>
<CollectionClient id=hgb>
<CollectionClient id=cop-dem-glo-30>
<CollectionClient id=cop-dem-glo-90>
<CollectionClient id=goes-cmi>
<CollectionClient id=terraclimate>
<CollectionClient id=nasa-nex-gddp-cmip6>
<CollectionClient id=gpm-imerg-hhr>
<CollectionClient id=gnatsgo-rasters>
<CollectionClient id=3dep-lidar-hag>
<CollectionClient id=io-lulc-annual-v02>
<CollectionClient id=3dep-lidar-intensity>
<CollectionClient id=3dep-lidar-pointsourceid>
<CollectionClient id=mtbs>
<CollectionClient id=noaa-c-cap>
<CollectionClient id=3dep-lidar-copc>
<CollectionClient id=modis-64A1-061>
<CollectionClient id=alos-fnf-mosaic>
<CollectionClient id=3dep-lidar-returns>
<CollectionClient id=mobi>
<CollectionClient id=landsat-c2-l2>
<CollectionClient id=era5-pds>
<CollectionClient id=chloris-biomass>
<CollectionClient id=kaza-hydroforecast>
<CollectionClient id=planet-nicfi-analytic>
<CollectionClient id=modis-17A2H-061>
<CollectionClient id=modis-11A2-061>
<CollectionClient id=daymet-daily-pr>
<CollectionClient id=3dep-lidar-dtm-native>
<CollectionClient id=3dep-lidar-classification>
<CollectionClient id=3dep-lidar-dtm>
<CollectionClient id=gap>
<CollectionClient id=modis-17A2HGF-061>
<CollectionClient id=planet-nicfi-visual>
<CollectionClient id=gbif>
<CollectionClient id=modis-17A3HGF-061>
<CollectionClient id=modis-09A1-061>
<CollectionClient id=alos-dem>
<CollectionClient id=alos-palsar-mosaic>
<CollectionClient id=deltares-water-availability>
<CollectionClient id=modis-16A3GF-061>
<CollectionClient id=modis-21A2-061>
<CollectionClient id=us-census>
<CollectionClient id=jrc-gsw>
<CollectionClient id=deltares-floods>
<CollectionClient id=modis-43A4-061>
<CollectionClient id=modis-09Q1-061>
<CollectionClient id=modis-14A1-061>
<CollectionClient id=hrea>
<CollectionClient id=modis-13Q1-061>
<CollectionClient id=modis-14A2-061>
<CollectionClient id=sentinel-2-l2a>
<CollectionClient id=modis-15A2H-061>
<CollectionClient id=modis-11A1-061>
<CollectionClient id=modis-15A3H-061>
<CollectionClient id=modis-13A1-061>
<CollectionClient id=daymet-daily-na>
<CollectionClient id=nrcan-landcover>
<CollectionClient id=modis-10A2-061>
<CollectionClient id=ecmwf-forecast>
<CollectionClient id=noaa-mrms-qpe-24h-pass2>
<CollectionClient id=sentinel-1-grd>
<CollectionClient id=nasadem>
<CollectionClient id=io-lulc>
<CollectionClient id=landsat-c2-l1>
<CollectionClient id=drcog-lulc>
<CollectionClient id=chesapeake-lc-7>
<CollectionClient id=chesapeake-lc-13>
<CollectionClient id=chesapeake-lu>
<CollectionClient id=noaa-mrms-qpe-1h-pass1>
<CollectionClient id=noaa-mrms-qpe-1h-pass2>
<CollectionClient id=noaa-nclimgrid-monthly>
<CollectionClient id=goes-glm>
<CollectionClient id=usda-cdl>
<CollectionClient id=eclipse>
<CollectionClient id=esa-cci-lc>
<CollectionClient id=esa-cci-lc-netcdf>
<CollectionClient id=fws-nwi>
<CollectionClient id=usgs-lcmap-conus-v13>
<CollectionClient id=usgs-lcmap-hawaii-v10>
<CollectionClient id=noaa-climate-normals-tabular>
<CollectionClient id=noaa-climate-normals-netcdf>
<CollectionClient id=noaa-climate-normals-gridded>
<CollectionClient id=aster-l1t>
<CollectionClient id=cil-gdpcir-cc-by-sa>
<CollectionClient id=naip>
<CollectionClient id=io-lulc-9-class>
<CollectionClient id=io-biodiversity>
<CollectionClient id=noaa-cdr-sea-surface-temperature-whoi>
<CollectionClient id=noaa-cdr-ocean-heat-content>
<CollectionClient id=cil-gdpcir-cc0>
<CollectionClient id=cil-gdpcir-cc-by>
<CollectionClient id=noaa-cdr-sea-surface-temperature-whoi-netcdf>
<CollectionClient id=noaa-cdr-sea-surface-temperature-optimum-interpolation>
<CollectionClient id=modis-10A1-061>
<CollectionClient id=sentinel-5p-l2-netcdf>
<CollectionClient id=sentinel-3-olci-wfr-l2-netcdf>
<CollectionClient id=noaa-cdr-ocean-heat-content-netcdf>
<CollectionClient id=sentinel-3-synergy-aod-l2-netcdf>
<CollectionClient id=sentinel-3-synergy-v10-l2-netcdf>
<CollectionClient id=sentinel-3-olci-lfr-l2-netcdf>
<CollectionClient id=sentinel-3-sral-lan-l2-netcdf>
<CollectionClient id=sentinel-3-slstr-lst-l2-netcdf>
<CollectionClient id=sentinel-3-slstr-wst-l2-netcdf>
<CollectionClient id=sentinel-3-sral-wat-l2-netcdf>
<CollectionClient id=ms-buildings>
<CollectionClient id=sentinel-3-slstr-frp-l2-netcdf>
<CollectionClient id=sentinel-3-synergy-syn-l2-netcdf>
<CollectionClient id=sentinel-3-synergy-vgp-l2-netcdf>
<CollectionClient id=sentinel-3-synergy-vg1-l2-netcdf>
<CollectionClient id=esa-worldcover>
[4]:
collection = cat.get_collection('aster-l1t')
collection
DEBUG:pystac_client.stac_api_io:GET https://planetarycomputer.microsoft.com/api/stac/v1/collections/aster-l1t Headers: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'}
[4]:
- type "Collection"
- id "aster-l1t"
- stac_version "1.0.0"
- description "The [ASTER](https://terra.nasa.gov/about/terra-instruments/aster) instrument, launched on-board NASA's [Terra](https://terra.nasa.gov/) satellite in 1999, provides multispectral images of the Earth at 15m-90m resolution. ASTER images provide information about land surface temperature, color, elevation, and mineral composition. This dataset represents ASTER [L1T](https://lpdaac.usgs.gov/products/ast_l1tv003/) data from 2000-2006. L1T images have been terrain-corrected and rotated to a north-up UTM projection. Images are in [cloud-optimized GeoTIFF](https://www.cogeo.org/) format. "
links [] 7 items
0
- rel "items"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/aster-l1t/items"
- type "application/geo+json"
1
- rel "parent"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/"
- type "application/json"
2
- rel "root"
- href "https://planetarycomputer.microsoft.com/api/stac/v1"
- type "application/json"
- title "Microsoft Planetary Computer STAC API"
3
- rel "self"
- href "https://planetarycomputer.microsoft.com/api/stac/v1/collections/aster-l1t"
- type "application/json"
4
- rel "license"
- href "https://www.usgs.gov/core-science-systems/hdds/data-policy"
- title "Public Domain"
5
- rel "describedby"
- href "https://planetarycomputer.microsoft.com/dataset/aster-l1t"
- type "text/html"
- title "Human readable dataset overview and reference"
6
- rel "describedby"
- href "https://planetarycomputer.microsoft.com/dataset/aster-l1t"
- type "text/html"
- title "Human readable dataset overview and reference"
stac_extensions [] 2 items
- 0 "https://stac-extensions.github.io/item-assets/v1.0.0/schema.json"
- 1 "https://stac-extensions.github.io/table/v1.2.0/schema.json"
item_assets
TIR
roles [] 1 items
- 0 "data"
- title "TIR Swath data"
eo:bands [] 5 items
0
- gsd 90
- name "TIR_Band10"
- common_name "lwir"
- description "thermal infrared"
- center_wavelength 8.3
- full_width_half_max 0.35
1
- gsd 90
- name "TIR_Band11"
- common_name "lwir"
- description "thermal infrared"
- center_wavelength 8.65
- full_width_half_max 0.35
2
- gsd 90
- name "TIR_Band12"
- common_name "lwir"
- description "thermal infrared"
- center_wavelength 9.11
- full_width_half_max 0.35
3
- gsd 90
- name "TIR_Band13"
- common_name "lwir"
- description "thermal infrared"
- center_wavelength 10.6
- full_width_half_max 0.7
4
- gsd 90
- name "TIR_Band14"
- common_name "lwir"
- description "thermal infrared"
- center_wavelength 11.3
- full_width_half_max 0.7
raster:bands [] 5 items
0
- name "TIR_Band10"
- nodata 0
- data_type "uint16"
- spatial_resolution 90
1
- name "TIR_Band11"
- nodata 0
- data_type "uint16"
- spatial_resolution 90
2
- name "TIR_Band12"
- nodata 0
- data_type "uint16"
- spatial_resolution 90
3
- name "TIR_Band13"
- nodata 0
- data_type "uint16"
- spatial_resolution 90
4
- name "TIR_Band14"
- nodata 0
- data_type "uint16"
- spatial_resolution 90
xml
- type "application/xml"
roles [] 1 items
- 0 "metadata"
- title "XML metadata"
SWIR
- type "image/tiff; application=geotiff; profile=cloud-optimized"
roles [] 1 items
- 0 "data"
- title "SWIR Swath data"
eo:bands [] 6 items
0
- gsd 30
- name "SWIR_Band4"
- common_name "swir"
- description "short-wave infrared"
- center_wavelength 1.65
- full_width_half_max 0.1
1
- gsd 30
- name "SWIR_Band5"
- common_name "swir"
- description "short-wave infrared"
- center_wavelength 2.165
- full_width_half_max 0.04
2
- gsd 30
- name "SWIR_Band6"
- common_name "swir"
- description "short-wave infrared"
- center_wavelength 2.205
- full_width_half_max 0.04
3
- gsd 30
- name "SWIR_Band7"
- common_name "swir"
- description "short-wave infrared"
- center_wavelength 2.26
- full_width_half_max 0.05
4
- gsd 30
- name "SWIR_Band8"
- common_name "swir"
- description "short-wave infrared"
- center_wavelength 2.339
- full_width_half_max 0.07
5
- gsd 30
- name "SWIR_Band9"
- common_name "swir"
- description "short-wave infrared"
- center_wavelength 2.395
- full_width_half_max 0.07
raster:bands [] 6 items
0
- name "SWIR_Band4"
- nodata 0
- data_type "uint8"
- spatial_resolution 30
1
- name "SWIR_Band5"
- nodata 0
- data_type "uint8"
- spatial_resolution 30
2
- name "SWIR_Band6"
- nodata 0
- data_type "uint8"
- spatial_resolution 30
3
- name "SWIR_Band7"
- nodata 0
- data_type "uint8"
- spatial_resolution 30
4
- name "SWIR_Band8"
- nodata 0
- data_type "uint8"
- spatial_resolution 30
5
- name "SWIR_Band9"
- nodata 0
- data_type "uint8"
- spatial_resolution 30
VNIR
- type "image/tiff; application=geotiff; profile=cloud-optimized"
roles [] 1 items
- 0 "data"
- title "VNIR Swath data"
eo:bands [] 3 items
0
- gsd 15
- name "VNIR_Band1"
- common_name "yellow/green"
- description "visible yellow/green"
- center_wavelength 0.56
- full_width_half_max 0.08
1
- gsd 15
- name "VNIR_Band2"
- common_name "red"
- description "visible red"
- center_wavelength 0.66
- full_width_half_max 0.06
2
- gsd 15
- name "VNIR_Band3N"
- common_name "near infrared"
- description "near infrared"
- center_wavelength 0.82
- full_width_half_max 0.08
raster:bands [] 3 items
0
- name "VNIR_Band1"
- nodata 0
- data_type "uint8"
- spatial_resolution 15
1
- name "VNIR_Band2"
- nodata 0
- data_type "uint8"
- spatial_resolution 15
2
- name "VNIR_Band3N"
- nodata 0
- data_type "uint8"
- spatial_resolution 15
qa-txt
- type "text/plain"
roles [] 1 items
- 0 "metadata"
- title "QA browse file"
- description "Geometric quality assessment report."
qa-browse
- type "image/jpeg"
roles [] 1 items
- 0 "thumbnail"
- title "QA browse file"
- description "Single-band black and white reduced resolution browse overlaid with red, green, and blue (RGB) markers for GCPs used during the geometric verification quality check."
tir-browse
- type "image/jpeg"
roles [] 1 items
- 0 "thumbnail"
- title "Standalone reduced resolution TIR"
vnir-browse
- type "image/jpeg"
roles [] 1 items
- 0 "thumbnail"
- title "VNIR browse file"
- description "Standalone reduced resolution VNIR"
- msft:container "aster"
- msft:storage_account "astersa"
- msft:short_description "The ASTER instrument, launched on-board NASA's Terra satellite in 1999, provides multispectral images of the Earth at 15m-90m resolution. This dataset contains ASTER data from 2000-2006."
- msft:region "westeurope"
- title "ASTER L1T"
extent
spatial
bbox [] 1 items
0 [] 4 items
- 0 -180
- 1 -90
- 2 180
- 3 90
temporal
interval [] 1 items
0 [] 2 items
- 0 "2000-03-04T12:00:00Z"
- 1 "2006-12-31T12:00:00Z"
- license "proprietary"
keywords [] 5 items
- 0 "ASTER"
- 1 "USGS"
- 2 "NASA"
- 3 "Satellite"
- 4 "Global"
providers [] 3 items
0
- name "NASA"
roles [] 2 items
- 0 "producer"
- 1 "licensor"
- url "https://terra.nasa.gov/about/terra-instruments/aster"
1
- name "USGS"
roles [] 3 items
- 0 "processor"
- 1 "producer"
- 2 "licensor"
- url "https://lpdaac.usgs.gov/data/get-started-data/collection-overview/missions/aster-overview/"
2
- name "Microsoft"
roles [] 2 items
- 0 "host"
- 1 "processor"
- url "https://planetarycomputer.microsoft.com"
summaries
gsd [] 3 items
- 0 15
- 1 30
- 2 90
eo:bands [] 14 items
0
- gsd 15
- name "VNIR_Band1"
- common_name "green"
- description "visible yellow/green"
- center_wavelength 0.56
- full_width_half_max 0.08
1
- gsd 15
- name "VNIR_Band2"
- common_name "red"
- description "visible red"
- center_wavelength 0.66
- full_width_half_max 0.06
2
- gsd 15
- name "VNIR_Band3N"
- common_name "nir08"
- description "near infrared"
- center_wavelength 0.82
- full_width_half_max 0.08
3
- gsd 30
- name "SWIR_Band4"
- common_name "swir16"
- description "short-wave infrared"
- center_wavelength 1.65
- full_width_half_max 0.1
4
- gsd 30
- name "SWIR_Band5"
- common_name "swir22"
- description "short-wave infrared"
- center_wavelength 2.165
- full_width_half_max 0.04
5
- gsd 30
- name "SWIR_Band6"
- common_name "swir22"
- description "short-wave infrared"
- center_wavelength 2.205
- full_width_half_max 0.04
6
- gsd 30
- name "SWIR_Band7"
- common_name "swir22"
- description "short-wave infrared"
- center_wavelength 2.26
- full_width_half_max 0.05
7
- gsd 30
- name "SWIR_Band8"
- description "short-wave infrared"
- center_wavelength 2.339
- full_width_half_max 0.07
8
- gsd 30
- name "SWIR_Band9"
- description "short-wave infrared"
- center_wavelength 2.395
- full_width_half_max 0.07
9
- gsd 90
- name "TIR_Band10"
- common_name "lwir"
- description "thermal infrared"
- center_wavelength 8.3
- full_width_half_max 0.35
10
- gsd 90
- name "TIR_Band11"
- common_name "lwir"
- description "thermal infrared"
- center_wavelength 8.65
- full_width_half_max 0.35
11
- gsd 90
- name "TIR_Band12"
- common_name "lwir"
- description "thermal infrared"
- center_wavelength 9.11
- full_width_half_max 0.35
12
- gsd 90
- name "TIR_Band13"
- common_name "lwir"
- description "thermal infrared"
- center_wavelength 10.6
- full_width_half_max 0.7
13
- gsd 90
- name "TIR_Band14"
- common_name "lwir"
- description "thermal infrared"
- center_wavelength 11.3
- full_width_half_max 0.7
platform [] 1 items
- 0 "terra"
instruments [] 1 items
- 0 "aster"
assets
thumbnail
- href "https://ai4edatasetspublicassets.blob.core.windows.net/assets/pc_thumbnails/aster.png"
- type "image/png"
- title "ASTER L1T"
roles [] 1 items
- 0 "thumbnail"
geoparquet-items
- href "abfs://items/aster-l1t.parquet"
- type "application/x-parquet"
- title "GeoParquet STAC items"
- description "Snapshot of the collection's STAC items exported to GeoParquet format."
msft:partition_info
- is_partitioned True
- partition_frequency "AS"
table:storage_options
- account_name "pcstacitems"
roles [] 1 items
- 0 "stac-items"
Items#
The main functions for getting items return iterators, where pystac-client will handle retrieval of additional pages when needed. Note that one request is made for the first ten items, then a second request for the next ten.
[5]:
items = collection.get_items()
# flush stdout so we can see the exact order that things happen
def get_ten_items(items):
for i, item in enumerate(items):
print(f"{i}: {item}", flush=True)
if i == 9:
return
print('First page', flush=True)
get_ten_items(items)
print('Second page', flush=True)
get_ten_items(items)
First page
DEBUG:pystac_client.stac_api_io:GET https://planetarycomputer.microsoft.com/api/stac/v1/collections/aster-l1t/items?collections=aster-l1t Headers: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'}
0: <Item id=AST_L1T_00312272006020322_20150518201805>
1: <Item id=AST_L1T_00312272006020313_20150518201753>
2: <Item id=AST_L1T_00312272006020304_20150518201753>
3: <Item id=AST_L1T_00312272006020256_20150518201805>
4: <Item id=AST_L1T_00312272006013731_20150518201743>
5: <Item id=AST_L1T_00312272006013722_20150518201738>
6: <Item id=AST_L1T_00312272006013714_20150518201738>
7: <Item id=AST_L1T_00312272006013705_20150517144401>
8: <Item id=AST_L1T_00312272006013656_20150517144401>
9: <Item id=AST_L1T_00312272006013647_20150517144406>
Second page
DEBUG:pystac_client.stac_api_io:GET https://planetarycomputer.microsoft.com/api/stac/v1/collections/aster-l1t/items?collections=aster-l1t&token=next:aster-l1t:AST_L1T_00312272006013647_20150517144406 Headers: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'}
0: <Item id=AST_L1T_00312272006013638_20150517144356>
1: <Item id=AST_L1T_00312272006013629_20150517144344>
2: <Item id=AST_L1T_00312272006013620_20150517144344>
3: <Item id=AST_L1T_00312272006013612_20150517144400>
4: <Item id=AST_L1T_00312272006013603_20150517144346>
5: <Item id=AST_L1T_00312272006013554_20150517144346>
6: <Item id=AST_L1T_00312272006013545_20150517144346>
7: <Item id=AST_L1T_00312272006013536_20150517144340>
8: <Item id=AST_L1T_00312272006013527_20150517144346>
9: <Item id=AST_L1T_00312272006013519_20150517144336>
API Search#
If the Catalog is an API, we have the ability to search for items based on spatio-temporal properties.
[6]:
# AOI around Delfzijl, in northern Netherlands
geom = {
"type": "Polygon",
"coordinates": [
[
[
6.42425537109375,
53.174765470134616
],
[
7.344360351562499,
53.174765470134616
],
[
7.344360351562499,
53.67393435835391
],
[
6.42425537109375,
53.67393435835391
],
[
6.42425537109375,
53.174765470134616
]
]
]
}
# limit sets the # of items per page so we can see multiple pages getting fetched
search = cat.search(
max_items = 15,
limit = 5,
collections = "aster-l1t",
intersects = geom,
datetime = "2000-01-01/2010-12-31",
)
items = list(search.items())
len(items)
DEBUG:pystac_client.stac_api_io:POST https://planetarycomputer.microsoft.com/api/stac/v1/search Headers: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '353', 'Content-Type': 'application/json'} Payload: {"limit": 5, "datetime": "2000-01-01T00:00:00Z/2010-12-31T23:59:59Z", "collections": ["aster-l1t"], "intersects": {"type": "Polygon", "coordinates": [[[6.42425537109375, 53.174765470134616], [7.344360351562499, 53.174765470134616], [7.344360351562499, 53.67393435835391], [6.42425537109375, 53.67393435835391], [6.42425537109375, 53.174765470134616]]]}}
DEBUG:pystac_client.stac_api_io:POST https://planetarycomputer.microsoft.com/api/stac/v1/search Headers: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '421', 'Content-Type': 'application/json'} Payload: {"limit": 5, "datetime": "2000-01-01T00:00:00Z/2010-12-31T23:59:59Z", "collections": ["aster-l1t"], "intersects": {"type": "Polygon", "coordinates": [[[6.42425537109375, 53.174765470134616], [7.344360351562499, 53.174765470134616], [7.344360351562499, 53.67393435835391], [6.42425537109375, 53.67393435835391], [6.42425537109375, 53.174765470134616]]]}, "token": "next:aster-l1t:AST_L1T_00307032006103813_20150515031748"}
DEBUG:pystac_client.stac_api_io:POST https://planetarycomputer.microsoft.com/api/stac/v1/search Headers: {'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '421', 'Content-Type': 'application/json'} Payload: {"limit": 5, "datetime": "2000-01-01T00:00:00Z/2010-12-31T23:59:59Z", "collections": ["aster-l1t"], "intersects": {"type": "Polygon", "coordinates": [[[6.42425537109375, 53.174765470134616], [7.344360351562499, 53.174765470134616], [7.344360351562499, 53.67393435835391], [6.42425537109375, 53.67393435835391], [6.42425537109375, 53.174765470134616]]]}, "token": "next:aster-l1t:AST_L1T_00305302006105006_20150514150004"}
[6]:
15
[7]:
# note that this will work in JupyterLab, but not in a Jupyter Notebook
import IPython.display
IPython.display.JSON([i.to_dict() for i in items])
[7]:
<IPython.core.display.JSON object>
[8]:
# this cell can be used in Jupyter Notebook. Use above if using JupyterLab
import json
import uuid
from IPython.display import display_javascript, display_html, display
class RenderJSON(object):
def __init__(self, json_data):
if isinstance(json_data, dict) or isinstance(json_data, list):
self.json_str = json.dumps(json_data)
else:
self.json_str = json_data
self.uuid = str(uuid.uuid4())
def _ipython_display_(self):
display_html('<div id="{}" style="height: 600px; width:100%;font: 12px/18px monospace !important;"></div>'.format(self.uuid), raw=True)
display_javascript("""
require(["https://rawgit.com/caldwell/renderjson/master/renderjson.js"], function() {
renderjson.set_show_to_level(2);
document.getElementById('%s').appendChild(renderjson(%s))
});
""" % (self.uuid, self.json_str), raw=True)
RenderJSON([i.to_dict() for i in items])