This is a followup question to another I recently had about the Google Maps API.
The following request returns zero results...
http://maps.googleapis.com/maps/api/geocode/json?address=801+BALTIMORE+STREET%2c+Hanover%2c+PA%2c+17331&sensor=false
However, from http://maps.google.com the following address locates correctly...
801 Baltimore Street, Hanover, PA
From the previous question the answer was because the result returned from maps is a "place" and not an "address".
My new question is how can you tell maps is returning a "place" vs and "address"? Is there something in the URL or the response that gives this away?
If you look at the response on Google Maps, notice the "3 reviews", that is a places entry. The way the entry reads also indicates it to me:
Giant
801 Baltimore St, Hanover, PA
(717) 632-6673 · giantfoodstores.com
3 reviews
It seems that the link above doesn't work the first time, but if you click on the "search" it finds it.
geocodezip:
thanks for the response.
assuming that the google maps web utilizes the places API, I tried to get the same result from places API.
for this address: 526+Kawailoa+Road,Kailua,Oahu,HI+96734
google maps does find the correct location. but geocoding API fails, so
I try the places API:
curl -v 'https://maps.googleapis.com/maps/api/place/textsearch/json?query=526+Kawailoa+Road,Kailua,Oahu,HI+96734&key=MY_API_KEY'
it returns a empty list. so why does the maps web page finds it but neither places API nor geocoding API finds it?
Thanks
Yang
Related
I am developing an app that displays the Distance & path between 2 distances. In this case I have used following addresses:
Source: Major Bhola Ram Enclave
Destination: Ring Road Mall, Sector 3, Rohini, New Delhi, Delhi
When I use Directions API then I get following result, see image below:
But, when I search these addresses in Google Maps then I get different Result.
Click here to see Google Maps result
I searched a lot about this but I couldn't find any reason/solution for this.
Please guid me in right direction.
Thanks.
Those are not addresses, they are places. If you want a similar result to Google Maps, you need to use the placeId or the coordinates returned for that place from the places service in the directions request.
http://www.geocodezip.com/v3_example_geo2.asp?addr1=Major%20Bhola%20Ram%20Enclave&addr2=Ring%20Road%20Mall,%20Sector%203,%20Rohini,%20New%20Delhi,%20Delhi&place=1&place=2
(uses the results from the place service)
When I try to geocode one of the adress using Google geocode api, Google api returns an incorrect location.
search address : republic of estonia
result from google api: spain
I am using javascript Google api to geocode the address. For some other location the result is correct but for above address its incorrect.
If we enter below url in browser, we get the JSON back and it is showing result somewhere in Spain rather than showing result in Estonia.
http://maps.googleapis.com/maps/api/geocode/json?address=republic%20of%20estonia
I tried same addres in maps.google.com and it takes me to correct location.
Have a look at the Estonia country feature in Map Maker:
https://www.google.com/mapmaker?iwloc=0_0&fmi=0_0&gw=39&fid=5085290329182063613:4677726785527621059&dtab=overview&ll=58.620408,24.93212&spn=3.101226,8.668213&z=7&lyt=large_map_v3&htll=58.560236,25.449737&hyaw=278.7642140009582
If you check the list of names for this feature, you will see that there is no 'Republic of Estonia' in the list. The name is simply 'Estonia'.
The request for 'Estonia' works as expected:
https://maps.googleapis.com/maps/api/geocode/json?address=estonia&key=YOUR_API_KEY
If you believe that 'Republic of Estonia' must be in the list of the names please Send a feedback (bottom right corner) to Google from this page
https://www.google.com/maps/place/Estonia/#58.7223142,23.1414399,7z/data=!4m5!3m4!1s0x4692949c82a04bfd:0x40ea9fba4fb425c3!8m2!3d58.595272!4d25.013607?hl=en
Google assumed you were looking for "Calle Estonia" or "Estonia Street".
You should request that Google add "Republic of Estonia" to their list of spaces. Google, and most other mapping services, only have "Estonia" or "EST" in their list of places.
Also, you may want to use a different API if you need to get an accurate answer. Google is really good, but Google tries to "guess" what you mean and always gives you a result. But, a service like SmartyStreets matches searches to databases of addresses (so if the search is not a "real" place, it will tell you).
(Full disclosure: I have worked for SmartyStreets.)
When I search on maps.google.com for the address "21-6 Udagawacho, Shibuya, Tokyo Prefecture 150-0042, Japan", it comes up with a result that is the correct result at that exact address.
When I try querying google maps geocoder as well as place service with the same address, however, I always get no results. I've tried the geocoder as well as textSearch and radarSearch for the place service API.
Since the correct result came up on maps.google.com I know that google has the data for the place but why does it not come up in the API queries?
Is there a way to restrict the Google geocoding API to search only for settlements as opposed to full addresses? The API documentation specifies a 'components' argument but that seems intended to specify a specific locality rather than localities in general.
For example a search for the town of Maskiot in Israel..
http://maps.googleapis.com/maps/api/geocode/json?address=Maskiot&sensor=false&components=country:IL
returns 'Maskit Street' near Tel Aviv, but the actual place I'm after is miles away, as a Google Maps search shows:
https://www.google.co.uk/maps/place/Maskiyot/#32.3178645,35.502754,15z/data=!3m1!4b1!4m2!3m1!1s0x151cf24adf97e761:0x4c10482c54ff115c
Very grateful for advice.
This problem is the result of the fact that you misspelled the name of the place.
In your original request you were using "Maskiot" whereas the place is actually "Maskiyot". If you change this name in your original request it all works fine.
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