Skip to content

Make it easier to get granule bounds from results #1269

@ameliaholcomb

Description

@ameliaholcomb

I would like to be able to use the spatial data returned by earthaccess.search_data. (I want to visualize the granule spatial coverage in an ROI without downloading the data. I am also interested in intersecting the granule bounds with more complex shapefiles not supported by the search_data API before download.)

Currently, I'm doing this with

geoms = []
for g in granules:
  coords = g['umm']['SpatialExtent']['HorizontalSpatialDomain']['Geometry']['GPolygons'][0]['Boundary']['Points']
  geoms.append(shapely.geometry.Polygon([(p['Longitude'], p['Latitude']) for p in coords]))
gdf = gpd.GeoDataFrame(geometry=geoms, crs="EPSG:4326")

This feels like odd/fragile code and it relies on undocumented (afaict?) features of the API, I'm not sure if this format is guaranteed to be stable in future versions.

Would it be possible for the API to return a GeoDataFrame of results? Or it would also be helpful to have a documented result class with data accessors, or to have the polygons returned in a standard (e.g. WKT, geojson) format.

Thanks so much for your work on this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions