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

Autocomplete doesn't use location sensitive features #107

Open
seanchrismurphy opened this issue Apr 16, 2021 · 2 comments
Open

Autocomplete doesn't use location sensitive features #107

seanchrismurphy opened this issue Apr 16, 2021 · 2 comments

Comments

@seanchrismurphy
Copy link

So, the map code is working great in Qualtrics - thanks! But, the autocomplete is not location-aware. The address within the map area often comes up low down in results until the full address is typed in (see picture - second result should be first). I know there are bounding options for autocomplete that can address this, but I can't decipher the javascript to add them.

image

@keita-makino
Copy link
Owner

keita-makino commented Apr 16, 2021

Thank you @seanchrismurphy, I didn't check if there's a corresponding option in the package that I use, let me review it and get back to you.

@seanchrismurphy
Copy link
Author

Note: I couldn't get this to work reactively (i.e. autocomplete within the map bounds), but I did find a way to set a bounded box in your script - hope that's helpful:

var t = new google.maps.places.Autocomplete(e, this.props.options);
            
                        // set a boundary box around southeast queensland
                        const southwest = { lat: -28.458248082416496,  lng: 151.6542799756878 };
                        const northeast = { lat: -25.944880587065512, lng: 154.08375270802287 };
                        const newBounds = new google.maps.LatLngBounds(southwest, northeast);
                        t.setBounds(newBounds);

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