Skip to main content

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


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.2.0.tar.gz (10.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.2.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stac_geoparquet-0.2.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for stac_geoparquet-0.2.0.tar.gz
Algorithm Hash digest
SHA256 de08b7c2de25d88d03c9c2435914eb07fba5b24022b0faa65f50dd60c53e18e3
MD5 6e7efba8283806d7c88a933d6a3842a3
BLAKE2b-256 8d7536efb3f3cb3919eac2435012bb0b3f94006a1cc133eb42552f09c50b3e6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for stac_geoparquet-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4cc6328b1e5d8eb2e6972da3c03edfe973dfa02e5d9483622e4ad7d6bd82edab
MD5 b46abfff1559a73e78cb7fec84978065
BLAKE2b-256 65050d75cf1e1ccd9bd9c43549379133bdac1fd10d8cfceb950f773160c55ce7

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