react-places-autocomplete icon indicating copy to clipboard operation
react-places-autocomplete copied to clipboard

Get appropriate zoom level for the selected place

Open sruthisripathi opened this issue 6 years ago • 1 comments

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.

sruthisripathi avatar Jun 18 '18 10:06 sruthisripathi

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

brunnolou avatar Sep 07 '21 10:09 brunnolou