Skip to content

Reading STAC output from satsearch library #256

Closed as not planned
Closed as not planned
@scottyhq

Description

@scottyhq

It appears pystac cannot currently read in the results from the https://github.com/sat-utils/sat-search library. Using the validation code in the pystac docs does not return any error, but i'm guessing the sat-search json returned is in fact not valid for some reason @matthewhanson or @lossyrob ?

import satsearch #v0.3.0
import pystac #v0.5.4

bbox = [35.48, -3.24, 35.58, -3.14]
dates = '2020-07-01/2020-08-15'
URL='https://earth-search.aws.element84.com/v0'
results = satsearch.Search.search(url=URL,
                                  collections=['sentinel-s2-l2a-cogs'],
                                  datetime=dates,
                                  bbox=bbox,    
                                  sort=['-properties.datetime'])

# 18 items found
items = results.items() #satstac.itemcollection.ItemCollection
print(len(items))
items.save('my-s2-l2a-cogs.json')

# validation returns empty list
import json
from pystac.validation import validate_dict
with open('my-s2-l2a-cogs.json') as f:
    js = json.load(f)
print(validate_dict(js))

# KeyError: 'links'
cat = pystac.read_file('my-s2-l2a-cogs.json')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions