Google Maps API - How to get only districts names of city? - google-maps

I would like to create a two-steps form using Google Maps API. At first, the user would like to select a city. Then, in next step, I want to generate a select list with district names of city (which was specified in first step).
I know how to create an autocomplete input with cities but I can't find any informations about districts. Is it possible using Google Maps API?

Related

Get all geolocations by partial name using google maps api

I have signed up with the Google Maps API. I can geolocate locations using the following query
url = f"https://maps.googleapis.com/maps/api/geocode/json?address={city}&key={api_key}"
I need to do a search for towns by partial name.
For example 'MyTown' is a town , but there are also towns with names which include 'MyTown' in the title, such as MyTown-By-Sea, MyTown-SomethingElse and even NiceMyTown
The above query using the API returns just the city MyTown, not the others
Is there some option I have missed to get the Google Maps API to be less specific in the response returned ?
You can use Places Autocomplete API web service. This API will return places suggestions or predictions, based on your given input.
https://maps.googleapis.com/maps/api/place/autocomplete/json
?input=MyTown (based on your example)
&location=latitude,longitude
&key=YOUR_API_KEY

Street and Road names in Google Map

I would like to retrieve all the road and street names, if i enters a area in search box. Is that possible in Google API ?
I have checked List of all street and road names in Google in API for solution, but there it is been given for auto complete box and the request is not for my requirement.
Also I learnt that Open Street Maps provide us these data, unfortunately I would like to perform some operations based upon the Google API's. So can you suggest me a way, otherthan OSM.
Google Maps API does not provide such functionality. However, there is a Google Maps Roads API which is one of their premium paid APIs which lets you query nearest road names and other road metadata. You can check that out here:
https://developers.google.com/maps/documentation/roads/intro
You can also try Overpass-Turbo (https://overpass-turbo.eu/) which lets you query OSM data. You can set the bounds and the OSM tags you are interested in.

Generate Google map link with nearby restaurants

Is there a way to generate a google map link which takes in lat , long values and shows me the place along with the nearby restaurants. Using the places API i get the required response but i get that in JSON format i require a link where you click and it opens up the google maps and shows your respective location and all the nearby restaurants.
If you use this link
http://maps.google.com/?q=lat,long it would show me the location corresponding to the lat,long along with that can i also pass in some parameter to locate the nearby restaurants as well something like http://maps.google.com/?q=lat,lng&nearBy=restaurant
If it can be of help to anyone who is facing a similar problem as i was. Found out a way to generate a google link which points to the google maps with nearby restaurants(any field you want to search for can be replaced with the restaurant string)
http://www.google.com/maps/search/restaurant/#your_latitude,your_longitude,17z
You can replace the /restaurant/ with /bank/ and get the nearby banks to the latitude,longitude specified in the link
http://www.google.com/maps/search/bank/#your_latitude,your_longitude,17z
17 is the zoom level you can change that as per your requirement.

Google Maps Places API - Autocomplete city suggestions, same city, different place_ids?

I'm creating a web application with a city autocomplete suggestion field using the Google Maps Place API. Once a city is selected I capture the place_id and write it to my database attached to my object.
Currently the Google Maps Places API is returning different place_id's for the same city suggestion when searched from a different location?
The following query returns a different place_id for the result 'Brisbane, Queensland, Australia' depending on where it's searched from.
QUERY → https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Brisbane&types=(cities)&key=AIzaSyBylZrzm8TS-jfEcBgyY9Um15NCDADLt44
Searched from Brisbane: place_id = ChIJuyD2XARakWsRwITe81qjAgU
Searched from Melbourne: place_id = ChIJM9KTrJpXkWsRQK_e81qjAgQ
Similar, but different :(
I thought specifying the types parameter as '(cities)' would keep all results consistent.
Is there another parameter or change to the query that will make it bulletproof?

Getting list of cities connected directly woth a city by road

Is there some way to get list of cities connected directly with a city using google maps api?
No, there isn't a way to do that with the Google Maps API. You would have to know which cities you're interested in before hand and use the Distance Matrix.