Hi brunj7, to load geojson from a file and use it in Python (we recommend the Python SDK for this, but you can also use the output with your own API calls):
# open file and read it as json
with open("./test.geojson") as f:
data = json.load(f)
The geojson in my test.geojson file simply contains a Polygon (i.e. not a Feature). If you load a Feature you will need to grab the `geometry` within.
Here’s a snippet that illustrates how to use the result with the SDK (see the SDK Getting Started guide first):
# open file and read it as json
with open("./test.geojson") as f:
data = json.load(f)
# for searching, you can pass the geojson data directly to the `geometry` field
[print(item) async for item in client.search(["PSScene"], geometry=data, limit=10)]
# if you prefer to create a GeometryFilter, use it with the `search_filter` field:
geom_filter = filters.geometry_filter(data)
[print(item) async for item in client.search(["PSScene"], search_filter=geom_filter, limit=10)]
To get geojson from a GeoPandas object, try using `geometry.__geo_interface__`. You should be able to pass that value to the search method or the geometry_filter function. Let me know if that works.
Lastly, if you want to store and re-use these geometries, check out Features API. You can also pass feature references directly to the above methods.