planetary-computer-sdk-for-python icon indicating copy to clipboard operation
planetary-computer-sdk-for-python copied to clipboard

Sign DataFrames from stac-geoparquet

Open TomAugspurger opened this issue 2 years ago • 0 comments

xref https://github.com/microsoft/PlanetaryComputer/discussions/200

It might be handy to take a semi-well defined DataFrame schema (maybe just an assets field with dict / object dtype?), like those returned by stac-geoparquet, and sign the URLs under it.

catalog = pystac_client.Client.open(
    "https://planetarycomputer.microsoft.com/api/stac/v1/",
    modifier=planetary_computer.sign_inplace,
)


asset = catalog.get_collection("io-lulc-9-class").assets["geoparquet-items"]

df = geopandas.read_parquet(
    asset.href, storage_options=asset.extra_fields["table:storage_options"]
)

df = planetary_computer.sign(df)

And now the URLs in df are signed.

TomAugspurger avatar Mar 19 '23 15:03 TomAugspurger