Skip to content

Commit

Permalink
fixed missing reprojection of pixel coordinates in mapper module
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas committed Oct 18, 2022
1 parent 279b7bb commit 2c896a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions eodal/operational/mapping/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,11 @@ def _get_observation(
res["sensing_date"] = scenes_date["sensing_date"].values[0]
res["scene_id"] = scenes_date["scene_id"].values[0]
res['sensing_time'] = scenes_date['sensing_time'].values[0]
# make sure the result is projected into the target EPSG code, otherwise
# the resulting GeoDataFrame contains wrong coordinates, i.e., the
# coordinates were not projected into the target CRS
if res.crs.to_epsg() != scenes_date.target_crs.unique()[0]:
res.to_crs(epsg=scenes_date.target_crs.unique()[0], inplace=True)
# or the feature
else:
if sensor.lower() == 'sentinel1':
Expand Down
4 changes: 4 additions & 0 deletions eodal/operational/mapping/sentinel2.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ def _read_multiple_scenes(
if feature_gdf.empty:
continue
res = feature_gdf
# make sure the coordinates are reprojected if necessary
if res.crs.to_epsg() != scenes_date.target_crs.unique()[0]:
res.to_crs(epsg=scenes_date.target_crs.unique()[0], inplace=True)

if isinstance(candidate_scene, (pd.Series, gpd.GeoSeries)):
res["sensing_date"] = candidate_scene["sensing_date"]
res['sensing_time'] = candidate_scene['sensing_time']
Expand Down

0 comments on commit 2c896a5

Please sign in to comment.