Create a STAC Items from multiple Assets
The Goal of this notebook is to show how to use the rio-stac API to create a STAC Item from multiple assets.
In [2]:
Copied!
import datetime
import pystac
from pystac.utils import str_to_datetime
import rasterio
# Import extension version
from rio_stac.stac import PROJECTION_EXT_VERSION, RASTER_EXT_VERSION, EO_EXT_VERSION
# Import rio_stac methods
from rio_stac.stac import (
get_dataset_geom,
get_projection_info,
get_raster_info,
get_eobands_info,
bbox_to_geom,
)
import datetime
import pystac
from pystac.utils import str_to_datetime
import rasterio
# Import extension version
from rio_stac.stac import PROJECTION_EXT_VERSION, RASTER_EXT_VERSION, EO_EXT_VERSION
# Import rio_stac methods
from rio_stac.stac import (
get_dataset_geom,
get_projection_info,
get_raster_info,
get_eobands_info,
bbox_to_geom,
)
In [3]:
Copied!
assets = [
{"name": "B01", "path": "./data/B01.tif", "href": None, "role": None},
{"name": "B02", "path": "./data/B02.tif", "href": None, "role": None},
{"name": "B03", "path": "./data/B03.tif", "href": None, "role": None},
{"name": "B04", "path": "./data/B04.tif", "href": None, "role": None},
{"name": "B05", "path": "./data/B05.tif", "href": None, "role": None},
]
media_type = pystac.MediaType.COG # we could also use rio_stac.stac.get_media_type
# additional properties to add in the item
properties = {}
# datetime associated with the item
input_datetime = None
# STAC Item Id
id = "my_stac_item"
# name of collection the item belongs to
collection = None
collection_url = None
extensions =[
f"https://stac-extensions.github.io/projection/{PROJECTION_EXT_VERSION}/schema.json",
f"https://stac-extensions.github.io/raster/{RASTER_EXT_VERSION}/schema.json",
f"https://stac-extensions.github.io/eo/{EO_EXT_VERSION}/schema.json",
]
assets = [
{"name": "B01", "path": "./data/B01.tif", "href": None, "role": None},
{"name": "B02", "path": "./data/B02.tif", "href": None, "role": None},
{"name": "B03", "path": "./data/B03.tif", "href": None, "role": None},
{"name": "B04", "path": "./data/B04.tif", "href": None, "role": None},
{"name": "B05", "path": "./data/B05.tif", "href": None, "role": None},
]
media_type = pystac.MediaType.COG # we could also use rio_stac.stac.get_media_type
# additional properties to add in the item
properties = {}
# datetime associated with the item
input_datetime = None
# STAC Item Id
id = "my_stac_item"
# name of collection the item belongs to
collection = None
collection_url = None
extensions =[
f"https://stac-extensions.github.io/projection/{PROJECTION_EXT_VERSION}/schema.json",
f"https://stac-extensions.github.io/raster/{RASTER_EXT_VERSION}/schema.json",
f"https://stac-extensions.github.io/eo/{EO_EXT_VERSION}/schema.json",
]
In [4]:
Copied!
bboxes = []
pystac_assets = []
img_datetimes = []
for asset in assets:
with rasterio.open(asset["path"]) as src_dst:
# Get BBOX and Footprint
dataset_geom = get_dataset_geom(src_dst, densify_pts=0, precision=-1)
bboxes.append(dataset_geom["bbox"])
if "start_datetime" not in properties and "end_datetime" not in properties:
# Try to get datetime from https://gdal.org/user/raster_data_model.html#imagery-domain-remote-sensing
dst_date = src_dst.get_tag_item("ACQUISITIONDATETIME", "IMAGERY")
dst_datetime = str_to_datetime(dst_date) if dst_date else None
if dst_datetime:
img_datetimes.append(dst_datetime)
proj_info = {
f"proj:{name}": value
for name, value in get_projection_info(src_dst).items()
}
raster_info = {
"raster:bands": get_raster_info(src_dst, max_size=1024)
}
eo_info = {}
eo_info = {"eo:bands": get_eobands_info(src_dst)}
cloudcover = src_dst.get_tag_item("CLOUDCOVER", "IMAGERY")
if cloudcover is not None:
properties.update({"eo:cloud_cover": int(cloudcover)})
pystac_assets.append(
(
asset["name"],
pystac.Asset(
href=asset["href"] or src_dst.name,
media_type=media_type,
extra_fields={
**proj_info,
**raster_info,
**eo_info
},
roles=asset["role"],
),
)
)
if img_datetimes and not input_datetime:
input_datetime = img_datetimes[0]
input_datetime = input_datetime or datetime.datetime.utcnow()
minx, miny, maxx, maxy = zip(*bboxes)
bbox = [min(minx), min(miny), max(maxx), max(maxy)]
# item
item = pystac.Item(
id=id,
geometry=bbox_to_geom(bbox),
bbox=bbox,
collection=collection,
stac_extensions=extensions,
datetime=input_datetime,
properties=properties,
)
# if we add a collection we MUST add a link
if collection:
item.add_link(
pystac.Link(
pystac.RelType.COLLECTION,
collection_url or collection,
media_type=pystac.MediaType.JSON,
)
)
for key, asset in pystac_assets:
item.add_asset(key=key, asset=asset)
item.validate()
bboxes = []
pystac_assets = []
img_datetimes = []
for asset in assets:
with rasterio.open(asset["path"]) as src_dst:
# Get BBOX and Footprint
dataset_geom = get_dataset_geom(src_dst, densify_pts=0, precision=-1)
bboxes.append(dataset_geom["bbox"])
if "start_datetime" not in properties and "end_datetime" not in properties:
# Try to get datetime from https://gdal.org/user/raster_data_model.html#imagery-domain-remote-sensing
dst_date = src_dst.get_tag_item("ACQUISITIONDATETIME", "IMAGERY")
dst_datetime = str_to_datetime(dst_date) if dst_date else None
if dst_datetime:
img_datetimes.append(dst_datetime)
proj_info = {
f"proj:{name}": value
for name, value in get_projection_info(src_dst).items()
}
raster_info = {
"raster:bands": get_raster_info(src_dst, max_size=1024)
}
eo_info = {}
eo_info = {"eo:bands": get_eobands_info(src_dst)}
cloudcover = src_dst.get_tag_item("CLOUDCOVER", "IMAGERY")
if cloudcover is not None:
properties.update({"eo:cloud_cover": int(cloudcover)})
pystac_assets.append(
(
asset["name"],
pystac.Asset(
href=asset["href"] or src_dst.name,
media_type=media_type,
extra_fields={
**proj_info,
**raster_info,
**eo_info
},
roles=asset["role"],
),
)
)
if img_datetimes and not input_datetime:
input_datetime = img_datetimes[0]
input_datetime = input_datetime or datetime.datetime.utcnow()
minx, miny, maxx, maxy = zip(*bboxes)
bbox = [min(minx), min(miny), max(maxx), max(maxy)]
# item
item = pystac.Item(
id=id,
geometry=bbox_to_geom(bbox),
bbox=bbox,
collection=collection,
stac_extensions=extensions,
datetime=input_datetime,
properties=properties,
)
# if we add a collection we MUST add a link
if collection:
item.add_link(
pystac.Link(
pystac.RelType.COLLECTION,
collection_url or collection,
media_type=pystac.MediaType.JSON,
)
)
for key, asset in pystac_assets:
item.add_asset(key=key, asset=asset)
item.validate()
Out[4]:
['https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json', 'https://stac-extensions.github.io/projection/v1.1.0/schema.json', 'https://stac-extensions.github.io/raster/v1.1.0/schema.json', 'https://stac-extensions.github.io/eo/v1.1.0/schema.json']
In [5]:
Copied!
import json
print(json.dumps(item.to_dict(), indent=4))
import json
print(json.dumps(item.to_dict(), indent=4))
{
"type": "Feature",
"stac_version": "1.0.0",
"id": "my_stac_item",
"properties": {
"datetime": "2023-12-08T09:55:37.520499Z"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-11.979244865430262,
24.296321392464336
],
[
-10.874546803397616,
24.296321392464336
],
[
-10.874546803397616,
25.304623891542274
],
[
-11.979244865430262,
25.304623891542274
],
[
-11.979244865430262,
24.296321392464336
]
]
]
},
"links": [],
"assets": {
"B01": {
"href": "./data/B01.tif",
"type": "image/tiff; application=geotiff; profile=cloud-optimized",
"proj:epsg": 32629,
"proj:geometry": {
"type": "Polygon",
"coordinates": [
[
[
199980.0,
2690220.0
],
[
309780.0,
2690220.0
],
[
309780.0,
2800020.0
],
[
199980.0,
2800020.0
],
[
199980.0,
2690220.0
]
]
]
},
"proj:bbox": [
199980.0,
2690220.0,
309780.0,
2800020.0
],
"proj:shape": [
549,
549
],
"proj:transform": [
200.0,
0.0,
199980.0,
0.0,
-200.0,
2800020.0,
0.0,
0.0,
1.0
],
"proj:projjson": {
"$schema": "https://proj.org/schemas/v0.4/projjson.schema.json",
"type": "ProjectedCRS",
"name": "WGS 84 / UTM zone 29N",
"base_crs": {
"name": "WGS 84",
"datum": {
"type": "GeodeticReferenceFrame",
"name": "World Geodetic System 1984",
"ellipsoid": {
"name": "WGS 84",
"semi_major_axis": 6378137,
"inverse_flattening": 298.257223563
}
},
"coordinate_system": {
"subtype": "ellipsoidal",
"axis": [
{
"name": "Geodetic latitude",
"abbreviation": "Lat",
"direction": "north",
"unit": "degree"
},
{
"name": "Geodetic longitude",
"abbreviation": "Lon",
"direction": "east",
"unit": "degree"
}
]
},
"id": {
"authority": "EPSG",
"code": 4326
}
},
"conversion": {
"name": "UTM zone 29N",
"method": {
"name": "Transverse Mercator",
"id": {
"authority": "EPSG",
"code": 9807
}
},
"parameters": [
{
"name": "Latitude of natural origin",
"value": 0,
"unit": "degree",
"id": {
"authority": "EPSG",
"code": 8801
}
},
{
"name": "Longitude of natural origin",
"value": -9,
"unit": "degree",
"id": {
"authority": "EPSG",
"code": 8802
}
},
{
"name": "Scale factor at natural origin",
"value": 0.9996,
"unit": "unity",
"id": {
"authority": "EPSG",
"code": 8805
}
},
{
"name": "False easting",
"value": 500000,
"unit": "metre",
"id": {
"authority": "EPSG",
"code": 8806
}
},
{
"name": "False northing",
"value": 0,
"unit": "metre",
"id": {
"authority": "EPSG",
"code": 8807
}
}
]
},
"coordinate_system": {
"subtype": "Cartesian",
"axis": [
{
"name": "Easting",
"abbreviation": "",
"direction": "east",
"unit": "metre"
},
{
"name": "Northing",
"abbreviation": "",
"direction": "north",
"unit": "metre"
}
]
},
"id": {
"authority": "EPSG",
"code": 32629
}
},
"proj:wkt2": "PROJCS[\"WGS 84 / UTM zone 29N\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-9],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"32629\"]]",
"raster:bands": [
{
"data_type": "uint16",
"scale": 1.0,
"offset": 0.0,
"sampling": "area",
"nodata": 0.0,
"statistics": {
"mean": 4774.295702403111,
"minimum": 1342,
"maximum": 7725,
"stddev": 509.38944965166854,
"valid_percent": 100.0
},
"histogram": {
"count": 11,
"min": 1342.0,
"max": 7725.0,
"buckets": [
366,
1478,
2385,
9548,
57747,
182460,
41982,
4332,
1010,
93
]
}
}
],
"eo:bands": [
{
"name": "b1",
"description": "gray"
}
]
},
"B02": {
"href": "./data/B02.tif",
"type": "image/tiff; application=geotiff; profile=cloud-optimized",
"proj:epsg": 32629,
"proj:geometry": {
"type": "Polygon",
"coordinates": [
[
[
199980.0,
2690220.0
],
[
309780.0,
2690220.0
],
[
309780.0,
2800020.0
],
[
199980.0,
2800020.0
],
[
199980.0,
2690220.0
]
]
]
},
"proj:bbox": [
199980.0,
2690220.0,
309780.0,
2800020.0
],
"proj:shape": [
549,
549
],
"proj:transform": [
200.0,
0.0,
199980.0,
0.0,
-200.0,
2800020.0,
0.0,
0.0,
1.0
],
"proj:projjson": {
"$schema": "https://proj.org/schemas/v0.4/projjson.schema.json",
"type": "ProjectedCRS",
"name": "WGS 84 / UTM zone 29N",
"base_crs": {
"name": "WGS 84",
"datum": {
"type": "GeodeticReferenceFrame",
"name": "World Geodetic System 1984",
"ellipsoid": {
"name": "WGS 84",
"semi_major_axis": 6378137,
"inverse_flattening": 298.257223563
}
},
"coordinate_system": {
"subtype": "ellipsoidal",
"axis": [
{
"name": "Geodetic latitude",
"abbreviation": "Lat",
"direction": "north",
"unit": "degree"
},
{
"name": "Geodetic longitude",
"abbreviation": "Lon",
"direction": "east",
"unit": "degree"
}
]
},
"id": {
"authority": "EPSG",
"code": 4326
}
},
"conversion": {
"name": "UTM zone 29N",
"method": {
"name": "Transverse Mercator",
"id": {
"authority": "EPSG",
"code": 9807
}
},
"parameters": [
{
"name": "Latitude of natural origin",
"value": 0,
"unit": "degree",
"id": {
"authority": "EPSG",
"code": 8801
}
},
{
"name": "Longitude of natural origin",
"value": -9,
"unit": "degree",
"id": {
"authority": "EPSG",
"code": 8802
}
},
{
"name": "Scale factor at natural origin",
"value": 0.9996,
"unit": "unity",
"id": {
"authority": "EPSG",
"code": 8805
}
},
{
"name": "False easting",
"value": 500000,
"unit": "metre",
"id": {
"authority": "EPSG",
"code": 8806
}
},
{
"name": "False northing",
"value": 0,
"unit": "metre",
"id": {
"authority": "EPSG",
"code": 8807
}
}
]
},
"coordinate_system": {
"subtype": "Cartesian",
"axis": [
{
"name": "Easting",
"abbreviation": "",
"direction": "east",
"unit": "metre"
},
{
"name": "Northing",
"abbreviation": "",
"direction": "north",
"unit": "metre"
}
]
},
"id": {
"authority": "EPSG",
"code": 32629
}
},
"proj:wkt2": "PROJCS[\"WGS 84 / UTM zone 29N\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-9],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"32629\"]]",
"raster:bands": [
{
"data_type": "uint16",
"scale": 1.0,
"offset": 0.0,
"sampling": "area",
"nodata": 0.0,
"statistics": {
"mean": 3704.1896078646055,
"minimum": 1149,
"maximum": 8069,
"stddev": 425.3794265417571,
"valid_percent": 100.0
},
"histogram": {
"count": 11,
"min": 1149.0,
"max": 8069.0,
"buckets": [
1193,
2792,
21120,
196053,
75547,
3758,
519,
212,
151,
56
]
}
}
],
"eo:bands": [
{
"name": "b1",
"description": "gray"
}
]
},
"B03": {
"href": "./data/B03.tif",
"type": "image/tiff; application=geotiff; profile=cloud-optimized",
"proj:epsg": 32629,
"proj:geometry": {
"type": "Polygon",
"coordinates": [
[
[
199980.0,
2690220.0
],
[
309780.0,
2690220.0
],
[
309780.0,
2800020.0
],
[
199980.0,
2800020.0
],
[
199980.0,
2690220.0
]
]
]
},
"proj:bbox": [
199980.0,
2690220.0,
309780.0,
2800020.0
],
"proj:shape": [
549,
549
],
"proj:transform": [
200.0,
0.0,
199980.0,
0.0,
-200.0,
2800020.0,
0.0,
0.0,
1.0
],
"proj:projjson": {
"$schema": "https://proj.org/schemas/v0.4/projjson.schema.json",
"type": "ProjectedCRS",
"name": "WGS 84 / UTM zone 29N",
"base_crs": {
"name": "WGS 84",
"datum": {
"type": "GeodeticReferenceFrame",
"name": "World Geodetic System 1984",
"ellipsoid": {
"name": "WGS 84",
"semi_major_axis": 6378137,
"inverse_flattening": 298.257223563
}
},
"coordinate_system": {
"subtype": "ellipsoidal",
"axis": [
{
"name": "Geodetic latitude",
"abbreviation": "Lat",
"direction": "north",
"unit": "degree"
},
{
"name": "Geodetic longitude",
"abbreviation": "Lon",
"direction": "east",
"unit": "degree"
}
]
},
"id": {
"authority": "EPSG",
"code": 4326
}
},
"conversion": {
"name": "UTM zone 29N",
"method": {
"name": "Transverse Mercator",
"id": {
"authority": "EPSG",
"code": 9807
}
},
"parameters": [
{
"name": "Latitude of natural origin",
"value": 0,
"unit": "degree",
"id": {
"authority": "EPSG",
"code": 8801
}
},
{
"name": "Longitude of natural origin",
"value": -9,
"unit": "degree",
"id": {
"authority": "EPSG",
"code": 8802
}
},
{
"name": "Scale factor at natural origin",
"value": 0.9996,
"unit": "unity",
"id": {
"authority": "EPSG",
"code": 8805
}
},
{
"name": "False easting",
"value": 500000,
"unit": "metre",
"id": {
"authority": "EPSG",
"code": 8806
}
},
{
"name": "False northing",
"value": 0,
"unit": "metre",
"id": {
"authority": "EPSG",
"code": 8807
}
}
]
},
"coordinate_system": {
"subtype": "Cartesian",
"axis": [
{
"name": "Easting",
"abbreviation": "",
"direction": "east",
"unit": "metre"
},
{
"name": "Northing",
"abbreviation": "",
"direction": "north",
"unit": "metre"
}
]
},
"id": {
"authority": "EPSG",
"code": 32629
}
},
"proj:wkt2": "PROJCS[\"WGS 84 / UTM zone 29N\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-9],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"32629\"]]",
"raster:bands": [
{
"data_type": "uint16",
"scale": 1.0,
"offset": 0.0,
"sampling": "area",
"nodata": 0.0,
"statistics": {
"mean": 3756.1745382397535,
"minimum": 1151,
"maximum": 7859,
"stddev": 422.8205914467619,
"valid_percent": 100.0
},
"histogram": {
"count": 11,
"min": 1151.0,
"max": 7859.0,
"buckets": [
1033,
2515,
13318,
159276,
117130,
6978,
687,
244,
159,
61
]
}
}
],
"eo:bands": [
{
"name": "b1",
"description": "gray"
}
]
},
"B04": {
"href": "./data/B04.tif",
"type": "image/tiff; application=geotiff; profile=cloud-optimized",
"proj:epsg": 32629,
"proj:geometry": {
"type": "Polygon",
"coordinates": [
[
[
199980.0,
2690220.0
],
[
309780.0,
2690220.0
],
[
309780.0,
2800020.0
],
[
199980.0,
2800020.0
],
[
199980.0,
2690220.0
]
]
]
},
"proj:bbox": [
199980.0,
2690220.0,
309780.0,
2800020.0
],
"proj:shape": [
549,
549
],
"proj:transform": [
200.0,
0.0,
199980.0,
0.0,
-200.0,
2800020.0,
0.0,
0.0,
1.0
],
"proj:projjson": {
"$schema": "https://proj.org/schemas/v0.4/projjson.schema.json",
"type": "ProjectedCRS",
"name": "WGS 84 / UTM zone 29N",
"base_crs": {
"name": "WGS 84",
"datum": {
"type": "GeodeticReferenceFrame",
"name": "World Geodetic System 1984",
"ellipsoid": {
"name": "WGS 84",
"semi_major_axis": 6378137,
"inverse_flattening": 298.257223563
}
},
"coordinate_system": {
"subtype": "ellipsoidal",
"axis": [
{
"name": "Geodetic latitude",
"abbreviation": "Lat",
"direction": "north",
"unit": "degree"
},
{
"name": "Geodetic longitude",
"abbreviation": "Lon",
"direction": "east",
"unit": "degree"
}
]
},
"id": {
"authority": "EPSG",
"code": 4326
}
},
"conversion": {
"name": "UTM zone 29N",
"method": {
"name": "Transverse Mercator",
"id": {
"authority": "EPSG",
"code": 9807
}
},
"parameters": [
{
"name": "Latitude of natural origin",
"value": 0,
"unit": "degree",
"id": {
"authority": "EPSG",
"code": 8801
}
},
{
"name": "Longitude of natural origin",
"value": -9,
"unit": "degree",
"id": {
"authority": "EPSG",
"code": 8802
}
},
{
"name": "Scale factor at natural origin",
"value": 0.9996,
"unit": "unity",
"id": {
"authority": "EPSG",
"code": 8805
}
},
{
"name": "False easting",
"value": 500000,
"unit": "metre",
"id": {
"authority": "EPSG",
"code": 8806
}
},
{
"name": "False northing",
"value": 0,
"unit": "metre",
"id": {
"authority": "EPSG",
"code": 8807
}
}
]
},
"coordinate_system": {
"subtype": "Cartesian",
"axis": [
{
"name": "Easting",
"abbreviation": "",
"direction": "east",
"unit": "metre"
},
{
"name": "Northing",
"abbreviation": "",
"direction": "north",
"unit": "metre"
}
]
},
"id": {
"authority": "EPSG",
"code": 32629
}
},
"proj:wkt2": "PROJCS[\"WGS 84 / UTM zone 29N\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-9],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"32629\"]]",
"raster:bands": [
{
"data_type": "uint16",
"scale": 1.0,
"offset": 0.0,
"sampling": "area",
"nodata": 0.0,
"statistics": {
"mean": 3815.5430970700163,
"minimum": 1164,
"maximum": 7793,
"stddev": 425.60416042616544,
"valid_percent": 100.0
},
"histogram": {
"count": 11,
"min": 1164.0,
"max": 7793.0,
"buckets": [
915,
2315,
10676,
132912,
142978,
10115,
997,
266,
165,
62
]
}
}
],
"eo:bands": [
{
"name": "b1",
"description": "gray"
}
]
},
"B05": {
"href": "./data/B05.tif",
"type": "image/tiff; application=geotiff; profile=cloud-optimized",
"proj:epsg": 32629,
"proj:geometry": {
"type": "Polygon",
"coordinates": [
[
[
199980.0,
2690220.0
],
[
309780.0,
2690220.0
],
[
309780.0,
2800020.0
],
[
199980.0,
2800020.0
],
[
199980.0,
2690220.0
]
]
]
},
"proj:bbox": [
199980.0,
2690220.0,
309780.0,
2800020.0
],
"proj:shape": [
549,
549
],
"proj:transform": [
200.0,
0.0,
199980.0,
0.0,
-200.0,
2800020.0,
0.0,
0.0,
1.0
],
"proj:projjson": {
"$schema": "https://proj.org/schemas/v0.4/projjson.schema.json",
"type": "ProjectedCRS",
"name": "WGS 84 / UTM zone 29N",
"base_crs": {
"name": "WGS 84",
"datum": {
"type": "GeodeticReferenceFrame",
"name": "World Geodetic System 1984",
"ellipsoid": {
"name": "WGS 84",
"semi_major_axis": 6378137,
"inverse_flattening": 298.257223563
}
},
"coordinate_system": {
"subtype": "ellipsoidal",
"axis": [
{
"name": "Geodetic latitude",
"abbreviation": "Lat",
"direction": "north",
"unit": "degree"
},
{
"name": "Geodetic longitude",
"abbreviation": "Lon",
"direction": "east",
"unit": "degree"
}
]
},
"id": {
"authority": "EPSG",
"code": 4326
}
},
"conversion": {
"name": "UTM zone 29N",
"method": {
"name": "Transverse Mercator",
"id": {
"authority": "EPSG",
"code": 9807
}
},
"parameters": [
{
"name": "Latitude of natural origin",
"value": 0,
"unit": "degree",
"id": {
"authority": "EPSG",
"code": 8801
}
},
{
"name": "Longitude of natural origin",
"value": -9,
"unit": "degree",
"id": {
"authority": "EPSG",
"code": 8802
}
},
{
"name": "Scale factor at natural origin",
"value": 0.9996,
"unit": "unity",
"id": {
"authority": "EPSG",
"code": 8805
}
},
{
"name": "False easting",
"value": 500000,
"unit": "metre",
"id": {
"authority": "EPSG",
"code": 8806
}
},
{
"name": "False northing",
"value": 0,
"unit": "metre",
"id": {
"authority": "EPSG",
"code": 8807
}
}
]
},
"coordinate_system": {
"subtype": "Cartesian",
"axis": [
{
"name": "Easting",
"abbreviation": "",
"direction": "east",
"unit": "metre"
},
{
"name": "Northing",
"abbreviation": "",
"direction": "north",
"unit": "metre"
}
]
},
"id": {
"authority": "EPSG",
"code": 32629
}
},
"proj:wkt2": "PROJCS[\"WGS 84 / UTM zone 29N\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-9],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"32629\"]]",
"raster:bands": [
{
"data_type": "uint16",
"scale": 1.0,
"offset": 0.0,
"sampling": "area",
"nodata": 0.0,
"statistics": {
"mean": 3825.699888188825,
"minimum": 1140,
"maximum": 7808,
"stddev": 431.14276343286804,
"valid_percent": 100.0
},
"histogram": {
"count": 11,
"min": 1140.0,
"max": 7808.0,
"buckets": [
819,
2294,
10344,
127145,
147857,
11167,
1259,
287,
169,
60
]
}
}
],
"eo:bands": [
{
"name": "b1",
"description": "gray"
}
]
}
},
"bbox": [
-11.979244865430262,
24.296321392464336,
-10.874546803397616,
25.304623891542274
],
"stac_extensions": [
"https://stac-extensions.github.io/projection/v1.1.0/schema.json",
"https://stac-extensions.github.io/raster/v1.1.0/schema.json",
"https://stac-extensions.github.io/eo/v1.1.0/schema.json"
]
}
In [ ]:
Copied!