Possible To Differentiate Between UK States - Google Maps JS API - google-maps

Is it possible to differentiate between Scotland, Wales, Northern Ireland and England when retrieving data via Google Maps, via the Javascript API or otherwise?
I have looked into a few examples in Google's docs, and it seems that Google does not give an option to differentiate between the different UK constituents.
The autocomplete examples for the JS API do have a return field 'STATE' but it is seems to only be used for US states and is returned null when querying a UK address. Google just returns 'United Kingdom' for the country when querying an address in the UK.
I need to get the country name back when I query Google Maps with a postcode.
EDIT/NOTE: if you give a city/town, only, in the query then Google DOES return the UK member state in the State field. But, Google is not returning the state when I search by postcode only, which is what I need.
Any ideas?
Thanks!

Related

Get all suburb results for specified postcode using Google Places Autocomplete API

We're using the Google Places autocomplete API feature and finding that our use case isn't working as expected.
In Australia, it is common for a postcode to have many suburbs attached to it.
When searching by postcode 2300:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=2300&types=(regions)&components=country:au&key=blah
We only get back one result, Bar Beach. But instead, there are many suburbs that belong to postcode 2300, as can be seen here:
http://auspost.com.au/postcode/2300
Ideally we'd like the user experience to be that typing 2300 returns all the suburbs associated so that the user can pick the exact one, especially as they all have different bounding boxes.
Is this possible with the Googe Places Autocomplete API?

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.

Google maps APIs to return place' type based on latitude & longitude

I am trying to build an application in which I need to retrieve location's type based on latitude and longitude. I tried using google's places API but not getting satisfied results.
For eg, if I want to know if the user searches for SFSU, it should be stored as 'university'. I can get its latitude/longitude from geocoding APIs.
https://maps.googleapis.com/maps/api/geocode/json?address=SFSU&key=YOUR_KEY
But from places API, I cannot get the exact type, I mostly get it as street or establishment:
https://maps.googleapis.com/maps/api/geocode/json?latlng=37.7244047,-122.4760196&key=YOUR_KEY
Similarly, I wanted to get cafe for any starbucks or mall/shopping-center for any mall.
Edit:
I got confused between geocode API and places API as geocode API also returns place' type.
I found that places API returns multiple results even if we provide correct latitude and longitude. So if we need the perfect result, we need to provide sort filter with Places API.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=(lat),(long)&rankby=distance&key=YOUR_API_KEY
It looks like you are using reverse geocoding, not the Places API.
Request to Places API should be something like:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=37.7244047%2C-122.4760196&radius=10&type=university&key=YOUR_API_KEY
This one returns 'San Francisco State University, 1600 Holloway Avenue, San Francisco'
https://developers.google.com/places/web-service/search#PlaceSearchRequests
Hope it helps!

Google maps GeoCode API doesn't return any result at all?

This is weird. When I search something like "The New York Palace Hotel,America,New York" in Google maps app's search box I get exactly the hotel on the map.
However When I use the maps API,
A GET at http://maps.googleapis.com/maps/api/geocode/json?address=The%20New%20York%20Palace%20Hotel,America,New%20York&sensor=true
I get ZERO results in the response.
It doesn't even give New York as the option in search results.
I am making an app where I use this API to get the lat-long for user provided address.
Now, I don't know why this Google maps API doesn't work the way the Google maps app works.
BUT I wanted to know, is there a way to search and provide Google maps API these search terms as meaningful words where instead of taking whole string as one parameter it knows which city I am searching and which Address I ams searching.
If not, then only option left with me will be to Once the first results fails I make another query for city name only.
recently, i was given a similar task, and came to know the api works reverse... i.e.. we can get address for lat lon that we provide.. and that too has its own restrictions (i.e.. no.of addresses resolved per request, mostly some 2500 address per day something...)....here you can get some info over that...
You are using the Geocoding API. "The New York Palace Hotel,America,New York" is not an address, it is a "place". The Places API might be a better option.
Example of your query using the (javascript version of) the Places API

how to get an administrative_area_level_1 list for a given country from google maps api?

I'm building a drill down interactive map
I want to use lists, that will enable the user to drill from continent to country to administrative_area_level_1 regions
is there a way to query google maps api and get a list of administrative_area_level_1 names for a given country?
I looked in geocoding - which gives me essentially a lat/lng coordinates for an address
also looked at reverse geocoding, that will return address components for a given lat/lng
not relevant...
i need a list of administrative_area_level_1 names for a given country...
I don't believe Google has a complete list or API for that information, but there are several resources that might be helpful:
Counties (US Census Data)
Cities (Google AdWords API
"Geographical Targets" (Google AdWords API)
That last one is ambiguous but seems to include quite a lot. You could probably filter it down to just what you need.
Unfortunately the Google Maps API does no provide this functionality. You will have to look into solutions such as the SimpleGeo Context API.