-
Notifications
You must be signed in to change notification settings - Fork 21
Description
The current implementation does not correctly project or reproject the metadata CSV information for bounding boxes. When working with metadata that specifies bounding boxes in EPSG:4326 (WGS 84), the CRS transformation to EPSG:27700 (British National Grid) was not applied correctly. As a result, the bounding box coordinates in the maps.parents object are misaligned with the expected CRS.
To Reproduce:
- Load a metadata CSV file with bounding box coordinates in EPSG:4326.
- Add the metadata to the
maps.parentsobject usingmaps.add_metadata. - Attempt to reproject the bounding box coordinates to EPSG:27700.
- Observe that the coordinates are not correctly transformed, and subsequent operations using these coordinates fail or are misaligned.
Expected behavior
The bounding box coordinates from the metadata CSV should be transformed correctly from EPSG:4326 to EPSG:27700 using a robust CRS transformation method. Once transformed, the coordinates should match the CRS of the parent images (EPSG:27700).
Desktop:
- OS: [Ubuntu 20.04]
- PythonVersion [3.12]
Additional context
To resolve this issue, the following code snippet was added to ensure the bounding box coordinates are correctly transformed:
from pyproj import Transformer
transformer = Transformer.from_crs("EPSG:4326", "EPSG:27700", always_xy=True)
for parent_id in maps.list_parents():
coords = maps.parents[parent_id]["coordinates"]
xmin, ymin, xmax, ymax = coords
new_coords = transformer.transform_bounds(xmin, ymin, xmax, ymax)
maps.parents[parent_id]["coordinates"] = new_coords
maps.parents[parent_id]["crs"] = "EPSG:27700"
Metadata
Metadata
Assignees
Labels
Type
Projects
Status