leaflet-control-geocoder icon indicating copy to clipboard operation
leaflet-control-geocoder copied to clipboard

Changing the default zoom of map

Open ragavendra opened this issue 1 year ago • 2 comments

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);

ragavendra avatar Feb 08 '24 23:02 ragavendra

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

Jack-Leey avatar Feb 21 '24 01:02 Jack-Leey

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!

Jack-Leey avatar Feb 21 '24 01:02 Jack-Leey