Skip to main content

No project description provided

Project description

STAC-geoparquet

Convert STAC items to GeoParquet.

Purpose

This library helps convert STAC Items to GeoParquet. While STAC Items are commonly distributed as individual JSON files on object storage or through a STAC API, STAC GeoParquet allows users to access a large number of STAC items in bulk without making repeated HTTP requests.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stac_geoparquet-0.5.0.tar.gz (91.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stac_geoparquet-0.5.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file stac_geoparquet-0.5.0.tar.gz.

File metadata

  • Download URL: stac_geoparquet-0.5.0.tar.gz
  • Upload date:
  • Size: 91.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for stac_geoparquet-0.5.0.tar.gz
Algorithm Hash digest
SHA256 bbd7cfbfea19a95c6455a58dc3a82036fd8243647bafa7b601bc51eac58072b2
MD5 f9e02decb2b448ca1cdc2a93839fb5de
BLAKE2b-256 a02c44251cd9bb0b79eed40f975b71c72f25af84a39263529932ee7c089ba7f0

See more details on using hashes here.

File details

Details for the file stac_geoparquet-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for stac_geoparquet-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e4acd4b8d45040b5badac2b2f09bce611fc168276cc5fa84e7136a0c336e42f
MD5 0882e56d7b6fe6c60dd278598e1db28e
BLAKE2b-256 4add5bf3d44512f1e087e5ee8bf0c480b98f9d2195586a89b81ceb18ca4faf13

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page