qualtrics-map icon indicating copy to clipboard operation
qualtrics-map copied to clipboard

Autocomplete doesn't use location sensitive features

Open seanchrismurphy opened this issue 3 years ago • 2 comments

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

seanchrismurphy avatar Apr 16 '21 04:04 seanchrismurphy

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.

keita-makino avatar Apr 16 '21 21:04 keita-makino

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);

seanchrismurphy avatar Jun 02 '21 05:06 seanchrismurphy