I'm trying to change some things on a map that is already initialised by another script, using the Leaflet library. This other script did not store the map-object in a global variable, or in any other location I can access with my script. So currently there is a map on my page, but I don't have the map object.
What I'd like to do is to retrieve the object of an already-initialised map, to make changes to it. For example, if there'd exist a function L.getMap('myID')
I'd like to use such a method to retrieve the map object linked to the container myID
.
TL;DR: Is there a way to get a map object of an already-initialised leaflet map, using the id of the container?
You can access the map from the global array created by the mediawiki extension.
Es: for accessing the first map of the page
window.maps.leafletList[0].map.getCenter()