-
Notifications
You must be signed in to change notification settings - Fork 504
Description
๐น Bug: Cannot render both WKT point and bounding box in same metadata field (spatialMetadataFields)
Summary
When using the geospatialMapViewer functionality (introduced in PR [#3540](#3540)) to render maps on item pages, it is not possible to include both a WKT POINT(...) and a bounding box {east=..., south=..., ...} in the same metadata field (e.g., dcterms.spatial), even though the documentation explicitly states this should work.
What happens
If an item has both entries in the same metadata field:
<dcvalue element="dcterms" qualifier="spatial">POINT(21.0122 52.2297)</dcvalue>
<dcvalue element="dcterms" qualifier="spatial">{east=45.0, south=34.5, north=72.0, west=-25.0, accuracyLevel=0}</dcvalue>The Angular frontend throws the following error:
Could not parse point from WKT string: undefined, error: Unable to parse: Parse error on line 1:
{EAST=45.0, SOUTH=34
^
Expecting 'POINT', ...
As a result, the map fails to render the bounding box, and may break entirely.
Expected behavior
According to the documentation:
https://github.com/kshepherd/dspace-geospatial-maps-doc/blob/main/README.md
You may use the same field for point and bounding box data โ only valid points will be shown as markers, and only valid shapes will be drawn as rectangles.
The frontend should:
- Treat
POINT(...)orlat,lonvalues as points - Treat
{east=..., south=..., ...}values as bounding boxes - Gracefully skip bbox strings during WKT parsing (rather than throw an error)
Suggested fix
In geospatial.functions.ts, the parseGeoJsonFromMetadataValue() function should skip values that start with { to avoid passing them to the WKT parser:
if (value.startsWith('{')) {
return null; // or throw new SkipThisValueError(), depending on existing structure
}Alternatively, introduce separate configuration options in geospatialMapViewer for pointFields and bboxFields to prevent misinterpretation of mixed metadata.
Environment
- DSpace Angular UI with geospatial PR Geospatial maps for item pages, search, browseย #3540
- DSpace 9.1 (tested with Docker build July 2025)
- Angular logs showing failure in
parseGeoJsonFromMetadataValue - Browsers: Chrome, Firefox
Metadata
Metadata
Assignees
Labels
Type
Projects
Status