mapRegionsApi = {
const map = mapApi.map;
const regionSource = new ol.source.Vector({
format: new ol.format.TopoJSON({
dataProjection: 'EPSG:3857'
}),
url: regionTopoJsonUrl,
attributions: '© EuroGeographics for the administrative boundaries'
});
const regionLayer = new ol.layer.Vector({
source: regionSource,
style: styleFunction
});
map.addLayer(regionLayer);
regionSource.once('change', () => {
map.getView().fit(regionSource.getExtent());
});
return { target: mapApi.target, map, regionLayer};
};