Reputation: 39
I use open layers 4 and I want that Overview Map to show always a whole map in central position, only the red box should move around overview map.
Upvotes: 3
Views: 345
Reputation: 17882
Specifying a overview map view with a single resolution and extent (i.e. center constraint) will work as long as the main map isn't panned so far that the center constraint on the overview is exceeded. e.g. this will give an almost global overview
new ol.control.OverviewMap({
view: new ol.View({
resolutions: [ol.tilegrid.createXYZ().getResolution(0)],
extent: [0, 0, 0, 0]
})
})
If you are using 2180 trying to show a world overview is going to cause reprojection errors! The overview will also need to be in EPSG:2180 with resolution and center constraint appropriate for that
new ol.control.OverviewMap({
view: new ol.View({
projection: 'EPSG:2180'
resolutions: [ ?? ],
extent: [x, y, x, y]
})
})
where ?? needs to be large enough to get all of Poland (and a bit more) in the overview and x, y is somewhere in the center of Poland in EPSG:2180 coordinates.
Upvotes: 1