Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
156 views
in Technique[技术] by (71.8m points)

googleplacesautocomplete - Google Places Autocomplete not returning certain cities

I'm having an issue with Google Places Autocomplete. This is the setup I'm using:

'https://maps.googleapis.com/maps/api/js?libraries=geometry,places&language=sv&region=se&key=' + key;
^ This is further up in the file and just here to show what I'm using.

const options = {
  types: ['(cities)'], 
  componentRestrictions: { country: "se" }
};

new google.maps.places.Autocomplete(element, options);

I'm using (cities), because I want to return actual cities only, and not countys or other locality results.

This works fine, however Google seem to make some sort of differentiation between a town registered as a place or an urban area.

For instance, the autocomplete returns the Swedish town Hemse which is a small town with apx 1700 ppl which is an urban area according to Wiki, but at the same time it does not return the bigger city Skene which has apx 5,800 people which is a place according to Wiki.

Is this just something Google does, or is there any way to change what types I'm using to get a wider scope of cities?

question from:https://stackoverflow.com/questions/65847149/google-places-autocomplete-not-returning-certain-cities

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...