stac-geoparquet
Project description
STAC-geoparquet
Convert STAC items to geoparquet.
Purpose
This library helps convert STAC Items to geoparquet. It might be useful for you if you host a large number of STAC items through a STAC API, but want to provide a bulk API for users who need to access many items.
Usage
stac_geoparquet.to_dataframe does it all. You give it a list of (STAC Item) dictionaries. It just converts them to a geopandas.GeoDataFrame, which can be written to parquet with .to_parquet.
>>> import requests
>>> import stac_geoparquet
>>> item = requests.get("https://planetarycomputer.microsoft.com/api/stac/v1/collections/naip/items/ia_m_4209150_sw_15_060_20190828_20191105").json()
>>> df = stac_geoparquet.to_geodataframe([item])
>>> df.to_parquet("naip.parquet")
Note that stac_geoparquet lifts the keys in the item properties up to the top level of the DataFrame, similar to geopandas.GeoDataFrame.from_features.
>>> list(df.columns)
['type',
'stac_version',
'stac_extensions',
'id',
'geometry',
'bbox',
'links',
'assets',
'collection',
'gsd',
'datetime',
'naip:year',
'proj:bbox',
'proj:epsg',
'naip:state',
'proj:shape',
'proj:transform']
We also provide stac_geoparquet.to_dict and stac_geoparquet.to_item_collection helpers that can be used to convert from DataFrames back to the original STAC items.
pgstac integration
stac_geoparquet.pgstac_reader has some helpers for working with items coming from a pgstac.items table. It takes care of
- Rehydrating the dehydrated items
- Partitioning by time
- Injecting dynamic links and assets from a STAC API
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stac_geoparquet-0.3.2.tar.gz.
File metadata
- Download URL: stac_geoparquet-0.3.2.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d7f15662eb137c3c576979b42cea529befe82ff7739eb4c3df591d58fc878e7
|
|
| MD5 |
817c834f2d1c2c6d52ab87ee29de4813
|
|
| BLAKE2b-256 |
68462e7178db36eb046d6638ab6e92519566c949f3e147be2830c0d53c1146a2
|
File details
Details for the file stac_geoparquet-0.3.2-py3-none-any.whl.
File metadata
- Download URL: stac_geoparquet-0.3.2-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8763321493a6a930f6b9e245f0e6a1a5788325f8f693bb691287d9c14182c5a
|
|
| MD5 |
eb78378d335d4cd97567a2985343022a
|
|
| BLAKE2b-256 |
ffd7e641f67ab4c1f65d678e835b57f1835806223a3281ee948ded755b32a487
|