leaflet-control-geocoder
leaflet-control-geocoder copied to clipboard
Changing the default zoom of map
hi,
Like asked in stack overflow here
I would like to change the default zoom setting of the map.
The default leaflet zoom setting for leaflet
is as below.
var center_ = [0, 0];
var map = L.map('map', {
center: center_,
zoom: 16
});
L.Control.geocoder().addTo(map);
geocoder.options.geocoder.reverse(e.latlng, map.getZoom(), function(results){ console.log(results[0].name); }); Why is the output always the country name regardless of the value of Zoom!! Here is a reference: https://wiki.openstreetmap.org/wiki/Zh-hans:Nominatim
geocoder.options.geocoder.reverse(e.latlng, map.getZoom(), function(results){ console.log(results[0].name);为什么输出始终是国家/地区名称,而不管 Zoom 的值如何!!这是一个参考:https://wiki.openstreetmap.org/wiki/Zh-hans:Nominatim
ok!! i know how to solve the problem: replace "map. options. crs. scale (map. getZoom())" to solve it!