react-places-autocomplete
react-places-autocomplete copied to clipboard
Get appropriate zoom level for the selected place
I want to get the appropriate zoom level depending on the place selected
Right now I get the lat and lon and set the map center to that. I am giving a static zoom level. If you manually zoom into or zoom out of the map (depending on the place you selected), then you will be able to properly see the place you selected on the map.
I was able to accomplished it by doing this:
geocodeByAddress(address)
.then((results) => {
const bounds = results[0].geometry.bounds;
mapRef.current.fitBounds(bounds);
mapRef.current.panToBounds(bounds);
})
No need to get the LatLong