core-geonetwork
core-geonetwork copied to clipboard
Metadata editor - map loads OSM layers even if a context file is configured
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
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?:
Nothing better to propose for now Jose.
It works for the UI settings, but not in the maps manager, as it uses the default config with the layer:
https://github.com/geonetwork/core-geonetwork/blob/997c494aad565e3810dbabcf9875001a435c6ac8/web-ui/src/main/resources/catalog/components/common/map/mapsManager.js#L154
I'm thinking to change the logic a bit, so if the context file is provided ignore the layers, I think doesn't make sense to use both.