Geographic Information Systems Asked by user158006 on September 28, 2021
By default, GeoNetwork Map Viewer renders the base OSM map at center 0 with zoom 2. I would like to change the center to a different point (like Paris) with a zoom of 6.
How to accomplish it by changing the 3.8.1 geonetwork core source directly?
From mapsManager.js, I tried changing center and zoom to different value under:
createMap: function(type) {
var config = gnMap.getMapConfig()['map-' + type];
var map = new ol.Map({
layers: [],
view: new ol.View({
center: [0, 0],
projection: gnMap.getMapConfig().projection,
zoom: 2
}),
I rebuilt the war and deployed it to app server, but it does not seem working.
Also saw the post on:
Focusing GeoNetwork default map on Canada?. But not clear what exactly change to the config-viewer.xml
Any insights?
I found a easy way to set it (which was from the older 3.x release):
views/default/config.js
//comment out the viewerMap, define it explicitly using the customized maps config
//var viewerMap = gnMapsManager.createMap(gnMapsManager.VIEWER_MAP);
var mapsConfig = {
center: [-39813045, 6213440],
zoom: 4
};
var viewerMap = new ol.Map({
controls: [],
view: new ol.View(mapsConfig)
});
Answered by user158006 on September 28, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP