Open i62lotor opened 3 years ago
Hi :wave:
Which version of the lib do you use?
Hi, smeijer
I have configured this dependency
"leaflet-geosearch": "^3.1.0"
Hi, again some more information. if the map is created in the same file, as in this example it works fine
const mapElement = document.createElement("div");
mapElement.setAttribute("id", "mapid");
mapElement.className = "map";
document.body.appendChild(mapElement);
const map = L.map('mapid').setView([0, 0], 5);
var osmLayer = L.tileLayer('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png',{
attribution: '© <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'
});
osmLayer.addTo(map);
const searchControl = new geoSearchControl({
provider: new OpenStreetMapProvider(),
});
map.addControl(searchControl);
However if I create the map in another class, and pass it as an argument to initialize the geoSearchControl, the error occurs. Example:
export const initialize = (context) => {
const searchControl = new geoSearchControl({
provider: new OpenStreetMapProvider(),
});
context.map.addControl(searchControl);
}
+1
+1
This occurs with OpenStreetMapProvider, but not GeoApiFR for instance. And when retainZoomLevel
is set to false, the error doesn't happen. (but This is not a satisfying solution).
For me, setting retainZoomLevel
to true
fixes the issue but also - not a satisfying solution.
Hi! I am trying to integrate leaflet-geosearch, but the same error is always repeated when I select an item from the result list
My code is very basic, same as the documentation example:
The OSM response is ok, but the error persist on showResult (no center map)
The map initilialization is:
Could anyone help me, please?
Thanks.