I am using the Google Maps API autocomplete. When I type in an address, I get suggestions. Valid results are bold, but invalid results are not. So, I might get an item in the drop down where the street name is bold, but the number is not:
So, if the users chooses 829 Wakely Terrace, I call getPlace and populate my address fields. But since its not a valid number, it looks like the number get stripped out. This is a confusing experience.
Can I force autocomplete to not do this?
Concersely, do I need some kind of "Did you mean this address?" functionality? Can anyone point me to an example of where this is handled well (Not for code, but UX purposes)?
I have a sort of answer. We were using the autocomplete widget from Google. Is till find it weird the whole bold/not bold thing, but if you use the AutocompleteService, you get the raw suggestions as JSON from Google. So, you need to do some more work to make the front end work, but you have a lot more control and con handle the situation as you see fit.
Related
I've noticed in Google Maps that something is named "vasquette" (and it appears to be the buttons in the top-right)... but what does the name actually mean and where does it come from? Does anyone know?
All I can find is a couple of tickets that reference it.
I have been following this example here: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform which shows how to have a field that implements the auto complete dropdown with Google maps, and then when the user selects an address to fill out the individual form elements (Like street name etc..).
The address field will already be filled out in my case though so I just need to fill out the form elements when the page loads using this address.
I have tried
$(document).ready(function(){
fillInAddress();
});
To force it on start but the form elements stay empty. Does any one have any ideas?
Thanks in advance!
I think doing only fillInAddress(); might not be enough, you have to do something with the autocomplete too. However, since it is not open source or mentioned anywhere in the docs, there seems to be no way to do that.
One work around would be to use the Places web service API to get the same info. For more information about that please refer to this.
On one of my sites I have a google maps pin, address and phone number included in my search result snippet. The problem is that it's the correct address but the phone number is wrong and I can't understand where this come from and how to change it or remove the maps snippet from the result. What I have read is that Google can use information from all over the web to produce a great snippet for my site but in my case it's not so great. Is it possible to change it in any way?
The correct answer to this question is that you can modify this information by changing the Google places information or suggest the change to Google.
I'm instantiating a google maps Autocomplete box, as such:
autocomplete = new google.maps.places.Autocomplete(input, options);
Now, when a user begins typing and the list of suggestions appears, if a user simply presses Enter I want the number one prediction to be used as the search term.
For example, when a user searches: London, I want to pull out and send London, United Kingdom - simply by the user pressing Enter.
I can pull out that prediction using (with the latest V3.11):
autocomplete.gm_accessors_.place.Gc.predictions[0].wg
However, this obviously relies on the "compiled" object names, such as Gc and wg which will change as Google updates their codebase.
What is the correct way of doing this? Is it supported by the Autocomplete API?
Notice
Please star this issue on Google to get a solution:
https://code.google.com/p/gmaps-api-issues/issues/detail?id=4945
there is no correct way when using places.Autocomplete, it's not implemented so far.
What you can do: the API creates the dropdown, a div with className "pac-container", and within that div for each prediction a div with the className "pac-item", you may use the text of the first .pac-item as value for the input.
A correct way would be to request the Places Autocomplete Service , but then you need to create the dropdown on your own.
The Google places (google.maps.places.Autocomplete) class that is available to use by linking an input box into a drop down list to display addresses from is causing me trouble when searching for establishments
I can generate this issue on the Google example page as well at:
google places example
I use this feature in my code much like the example above by including a reference to the places API:
<script src="//maps.googleapis.com/maps/api/js?sensor=false&libraries=places"
type="text/javascript"></script>
The problem seems to be mainly around [Establishments]. But not just any establishments. It only occurs on some now and again.
The one I have particular issue with at the moment is when I type in the Name United campervan rentals, and select the resulting drop-down. The address that is returned in the autocomplete.getPlace() command is not address I would expect. The address returned is the middle of the bounds set when creating the autocomplete object.
However as per maps.google.co.nz, I an expecting an address of 3 Kingsford Smith Place.
I've tried it in a number of browsers including IE 8, 9, Chrome, FF 3.6. All produce the same result. I've also tried at different times of the day and the same result.
I had posted this on the Google API forum but read an article that they are moving their Q&A to SO, so as long as I add the appropriate tags someone may be able to offer some sort of insight. I'm really hoping this is the case. Cheers.
For anyone who reads this I logged an issue on the gmaps API issue site and after a few days the issue was cleared as fixed. This also resolved the question.