Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to set custom zoom into map when location found #346

Open
marketdevsoft opened this issue Mar 8, 2024 · 2 comments
Open

how to set custom zoom into map when location found #346

marketdevsoft opened this issue Mar 8, 2024 · 2 comments

Comments

@marketdevsoft
Copy link

Hi,
i need to change default map-zoom level of search result.
I try with this code but doesn't work :

        .on('markgeocode', function(e) {
            map.setZoomAround(e.geocode.bbox.getCenter(), 10);
        }) 

Can someone help me?

@analoghifi
Copy link

I have the same problem

@analoghifi
Copy link

in the meantime found a workaround for me:

var initial_zoom = 17;
.
.
var map = L.map('map', mapOptions);
.
.
var myGeocoder = L.Control.geocoder(geoCoderOptions).addTo(map);
.
.
myGeocoder.on('markgeocode', function(e) {
	map.setZoom(initial_zoom, {animate: false});
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants