I'm initializing a map using leaflet(openstreetmaps) in angular and setting a center that the user sees when opening the site. How can i change the center so the map rotates to the new coordinates on click of eg a button? Setting a new center doesn't appear to do anything, neither do i want to reload the site itself. Thanks!
private initMap(): void {
this.map = L.map('map', {
center: [48.1841234, 11.5877796],
zoom: 16
});}
you can use map.flyTo([latlng])
or map.panTo([latlng])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.