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

Bounds, location, and radius in the Maps JavaScript API Place Autocomplete Service (Deprecated as of May 2023) #1135

Open
JacobGeoGeek opened this issue Sep 27, 2023 · 3 comments

Comments

@JacobGeoGeek
Copy link

JacobGeoGeek commented Sep 27, 2023

Bug Report

When I am using the usePlacesAutocomplete, a waning appears in my browsing console:

places_impl.js:15 As of May 2023, bounds, location, and radius are deprecated. Please use locationBias and locationRestriction instead. The feature will continue to work, and 12 months notice will be given before support is discontinued. See https://developers.google.com/maps/deprecations for more information.

How to Reproduce

Add the following code and create a widget to search an address (like a AutoComplete input):

  const defaultBounds = new window.google.maps.LatLngBounds(
    new window.google.maps.LatLng(44.306576, -79.372785),
    new window.google.maps.LatLng(62.683234, -57.905501)
  )

  const {
    ready,
    value,
    setValue,
    suggestions,
    clearSuggestions
  } = usePlacesAutocomplete({
    requestOptions: {
      componentRestrictions: { country: "ca" },
      bounds: defaultBounds
    }
  })

Your Environment

  • Device: [MacBook Pro]
  • OS: [macOS]
  • Browser: [Chrome]
  • Version: [Chrome: 117.0.5938.92 (Official Build) (x86_64)]

Additional Information

Perhaps an update is necessary to support the new attributes: locationBias and locationRestriction.

@wellyshen
Copy link
Owner

@JacobGeoGeek You can pass any valid properties into the requestOptions, I think they should just work.

@eliawk
Copy link

eliawk commented Nov 14, 2023

@wellyshen componentRestrictions: { country: 'us' }doesn't work

@bcaylor10
Copy link

Any update on this? This is a big requirement, and I will have to move to another library if I cannot filter by country through the request itself

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

4 participants