geonetwork / geonetwork/core-geonetwork
Metadata editor - map loads OSM layers even if a context file is configured
- Dominant language
- Java
- Stars
- 521
- Forks
- 514
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 19
Description
Tested in GeoNetwork 3.10:
By default the editor map has no context defined, only the `Layer objects in JSON` property with the value `{"type":"osm"}`.
It can be configured a context file, but some issues to get it working.

- `Layer objects in JSON` property can't be removed and if emptied seem restored back to the default value `{"type":"osm"}`. This causes that the following code always loads the layers defined in the property:
https://github.com/geonetwork/core-geonetwork/blob/997c494aad565e3810dbabcf9875001a435c6ac8/web-ui/src/main/resources/catalog/components/common/map/mapsManager.js#L259
- In the search / viewer map configuration, `Layer objects in JSON` is not defined by default and can be added if required (and removed), so the context file works.
----
When removing the property the following code is executed:
https://github.com/geonetwork/core-geonetwork/blob/997c494aad565e3810dbabcf9875001a435c6ac8/web-ui/src/main/resources/catalog/components/admin/uiconfig/UiConfigDirective.js#L43-L51
That merges the default configuration, adding the `osm` layer:
https://github.com/geonetwork/core-geonetwork/blob/997c494aad565e3810dbabcf9875001a435c6ac8/web-ui/src/main/resources/catalog/js/CatController.js#L266-L270
@fxprunayre any reason to execute the `init` method after removing the property. The merge mechanism seem that forces the default properties always, not very optimal as properties with default values like this can't be removed.
I see this code, that it's emptying some properties, I guess should be done the same with the map editor layers to use the UI configuration, sounds fine?:
https://github.com/geonetwork/core-geonetwork/blob/997c494aad565e3810dbabcf9875001a435c6ac8/web-ui/src/main/resources/catalog/js/CatController.js#L360-L365
Contributor guide
Research direction
Start with web-ui/src/main/resources/catalog/components/common/map/mapsManager.js and the property-removal flow in catalog/components/admin/uiconfig/UiConfigDirective.js. Read the related default-merge logic in catalog/js/CatController.js, including the existing property-clearing code; done means a configured context file prevents the editor map from loading the default OSM layer after the layer property is removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100