geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
412 stars 487 forks source link

Metadata editor - map loads OSM layers even if a context file is configured #4655

Open josegar74 opened 4 years ago

josegar74 commented 4 years ago

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.

editor-map-configuration

https://github.com/geonetwork/core-geonetwork/blob/997c494aad565e3810dbabcf9875001a435c6ac8/web-ui/src/main/resources/catalog/components/common/map/mapsManager.js#L259


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

fxprunayre commented 4 years ago

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.

josegar74 commented 4 years ago

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.