Plugin Author
MiKa
(@photoweblog)
Hi @ckarisch
hmm, I am not sure. With jQuery call the OpenLayers function
map.updateSize();
could work. But the “map” is generated dynmically so you will have to look at your pagesource and “map” can change if you add or delete a osm-map on this site.
The plugin does not support an out-of-the-box solution.
Br, Michael
Thank you. I tried to call that method, but it was not possible the map var is defined locally. I tried to redefine the map var:
const map = L.map(‘osm-map-cbcc74b’, {
scrollWheelZoom: true,
zoomControl: true,
dragging: true });
But than i get this error: Uncaught Error: Map container is already initialized.
Kind regards, Chris
Plugin Author
MiKa
(@photoweblog)
Hi @ckarisch,
change the WP OSM Plugin:
Create a static osm plugin function to refresh it with updateSize and provide a call to refresh all maps or just one specific. I assume refresh all would be easier since you do not know which one you want to refresh. Then call this new function in your private coding.
If it works and after I did some tests I could also take it to the standard so you will get plugin updates in future without loosing your call.
But if you know how to code it could be also easier to simply have a look to the leaflet or openlayers libraries and write the mapping part exactly to your needs.
Br, Michael
Many thanks for the help. In the meantime, however, I have decided on a different solution that does not require a refresh.
Kind regards
Chris