Skip to content

Commit

Permalink
small cleanup: no random renaming of geometry column
Browse files Browse the repository at this point in the history
  • Loading branch information
jdries committed Sep 30, 2024
1 parent 8b6a79f commit 5670075
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions openeo/extra/stac_job_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,12 @@ def series_from(item):


# Convert geojson geom into shapely.Geometry

item_dict["properties"]["geometry"] = shape(item_dict["geometry"])
item_dict["properties"]["name"] = item_id
#item_dict["properties"]["name"] = item_id
return pd.Series(item_dict["properties"], name=item_id)

@staticmethod
def item_from(series, geometry_name="geometry"):
def item_from(series: pd.Series, geometry_name="geometry"):
"""
Convert a pandas.Series to a STAC Item.
Expand Down Expand Up @@ -98,8 +97,7 @@ def item_from(series, geometry_name="geometry"):
del series_dict[geometry_name]

# from_dict handles associating any Links and Assets with the Item
item_dict['id'] = series['name']
del series_dict['name']
item_dict['id'] = series.name
item = pystac.Item.from_dict(item_dict)
item.bbox = series[geometry_name].bounds
return item
Expand Down Expand Up @@ -134,7 +132,7 @@ def get_by_status(self, statuses: List[str], max=None) -> pd.DataFrame:
gdf = gpd.GeoDataFrame(series, crs=crs)
# TODO how to know the proper name of the geometry column?
# this only matters for the udp based version probably
gdf.rename_geometry("polygon", inplace=True)
#gdf.rename_geometry("polygon", inplace=True)
return gdf


Expand Down

0 comments on commit 5670075

Please sign in to comment.