I am trying to resolve an address using Google gecode. The address is imported from elsewhere or user entered and not very orderly.
With the address spaced out like this:
O/s NCP Car Park, Coram St Jn Woburn Place London WC1
or spaces replaced with "+"
O/s+NCP+Car+Park,Coram+St+Jn+Woburn+Place+London+WC1
My code will attempt to match the address in full and then word by word will remove leading words until a match occurs.
In Google Maps this resolves fine but even when my address is reduced to
"Woburn Place London WC1"
gecode will not resolve.
These seems to me to be a pretty tidy address with capital city and postcode.
Should I be using some other maps function?
I already tried autocomplete+places and that was resolving even less of my addresses list.
thanks all,
jON
The Google Maps Places API textSearch finds two results for that string ("O/s NCP Car Park,Coram St Jn Woburn Place London WC1"):
Found 2 results for O/s NCP Car Park,Coram St Jn Woburn Place London WC1
[ 0 ]: London, United Kingdom (51.523813, -0.12609699999995883)
[ 1 ]: Woburn Place, Coram St, London WC1H 0ND, United Kingdom (51.5238677, -0.12642860000005385)
To use the geocoding API you need to use "WC1H" for the postcode:
Found 1 results for O/s NCP Car Park,Coram St Jn Woburn Place London WC1H
[ 0 ]: Woburn Pl, London WC1H, UK (51.5237701, -0.12688589999993383)
url: https://maps.googleapis.com/maps/api/geocode/json?address=O/s%20NCP%20Car%20Park,Coram%20St%20Jn%20Woburn%20Place%20London%20WC1H
Related
Below two placeID's gives the same address.
1. EicyMDEgU291dGggTG93cnkgU3RyZWV0LCBTbXlybmEsIFROLCBVU0EiMRIvChQKEgm7_A4lPAxkiBEptR2cpqTb1xDJASoUChIJT4MxvQIMZIgRENDVZ6XiGTc
2. ChIJBbYyJDwMZIgR1TtBueaig5w
PlaceID1 was returned when the address searched using the autocomplete was " 201 South Lowry Street" and PlaceID2 was returned when the address searched using the autocomplete was " Goodwill Industries of Middle Tennessee 201 South Lowry Street".
Even though the above addresses are different, the place details API gives the same address information.
https://maps.googleapis.com/maps/api/place/details/json?place_id=EicyMDEgU291dGggTG93cnkgU3RyZWV0LCBTbXlybmEsIFROLCBVU0EiMRIvChQKEgm7_A4lPAxkiBEptR2cpqTb1xDJASoUChIJT4MxvQIMZIgRENDVZ6XiGTc&key=API_KEY
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJBbYyJDwMZIgR1TtBueaig5w&key=API_KEY
Question :
1. Why is the same address which is of the street returned for two different placeID's?
2. The location returned by places Details API is correct but the address is of the street.
Below are few more examples where I observed same scenarios. Could you please brief on the below mentioned examples also?
PlaceID : ChIJZ2fZgcNVZIgRRY-uzGW9IBc and ChIJi15Hp8RVZIgRojWuKm_aG3M returned the same address as "2008 Memorial Boulevard Springfield Tennessee United States 37172", but the straight line distance between the two places is approximately 154 meters.
PlaceID : EiBBbm5leCBBdmVudWUsIE5hc2h2aWxsZSwgVE4sIFVTQSIuKiwKFAoSCd8ldk-TYWSIEZbufa-nQvmSEhQKEgk9kOsTMuxkiBGg2umh0Lk_fQ and ChIJ9ynrOIthZIgR-_7_cmwzeXo returned the same address as "3736, Annex Avenue Nashville Tennessee 37209" , but the straight line distance between the two places is approximately 6.92 meters.
PlaceID : ChIJTZvXpuJ7ZIgR8GqA7eDu5oY and ChIJ3ZUKweJ7ZIgRBjj8OqdMm5E returned the same address as "1777, Galleria Boulevard Franklin Tennessee 37067 " , but the straight line distance between the two places is approximately 12.24 meters.
PlaceID : EicyMDEgU291dGggTG93cnkgU3RyZWV0LCBTbXlybmEsIFROLCBVU0EiMRIvChQKEgm7_A4lPAxkiBEptR2cpqTb1xDJASoUChIJT4MxvQIMZIgRENDVZ6XiGTc and ChIJBbYyJDwMZIgR1TtBueaig5w returned the same address as "201 S Lowry St, Smyrna, TN 37167, United States " , but the straight line distance between the two places is approximately 97 meters.
Please note that it's possible for each place or feature to have similar addresses. This is why the Places API used Place IDs instead to uniquely identify the place/feature. As per this doc:
Place IDs uniquely identify a place in the Google Places database and
on Google Maps.
Below is my investigation on the addresses you have mentioned:
The place ID, ChIJZ2fZgcNVZIgRRY-uzGW9IBc, is of type, premise. As per the Address Types doc here:
Premise indicates a named location, usually a building or collection
of buildings with a common name.
If you think that a collection of building should not have the same address as the Place ID, ChIJi15Hp8RVZIgRojWuKm_aG3M, then I suggest that you report this Maps Data issue. (I'll put some more details on how to report Maps Data issues below)
The address returned for EiBBbm5leCBBdmV...iBGg2umh0Lk_fQ is an address of a route (Annex Ave, Nashville, TN 37209, USA), which is not the same as the the second Place ID's (ChIJ9ynrOIthZIgR-_7_cmwzeXo) address (3734 Annex Ave, Nashville, TN 37209, USA).
For the Item #3, what I can see is that the place ChIJTZvXpuJ7ZIgR8GqA7eDu5oY is a street_address while the other feature (ChIJ3ZUKweJ7ZIgRBjj8OqdMm5E) is a point_of_interest. These two features does not seem to be related so I believe that this is another Maps Data issue which can also be reported.
The feature, EicyMDEgU29...ENDVZ6XiGTc, on the other hand appears to be an inferred street address from a range of addresses. While the place, ChIJBbYyJDwMZIgR1TtBueaig5w, is the actual point_of_interest that's on that same street address. Note that the point of interest may close or move to a new location, but, the street address most likely won't change.
For Maps Data issues, this can be reported using the "Report a
Problem" or "Send feedback" link on the bottom right corner on
maps.google.com or in the Google Maps for Mobile Application. To learn
more, please see this guide. But for Maps Data that are added
using Google My Business, this can be modified directly by the
business owners themselves on their Google My Business account.
I hope this helps!
Geocode returns postal_code value null for certain addresses and I am not able to do reverse address lookup to retrieve the zip at that level.
An example address is "Peachtree Dunwoody Road, Atlanta, GA, United States"
There is no street number; Dunwoody is also a city name in vicinity. It is not happening for all two words street names, but happening only if one of the word(second one in the street name) is also a city name.
It works for most of the cases but just a few certain types ie "Peachtree Street Northwest, Atlanta, GA, United States"
The search is for "address".
geoLocationScript: "https://maps.googleapis.com/maps/api/js?",
geoLocationSensor: "sensor=false",
Is it a google glitch? and Is there any work around?
Zip codes actually only correspond to mailing routes. "Peachtree Dunwoody Road, Atlanta, GA, United States" isn't a mailing address and as such Google is trying to give you the best results it can, balancing exactness with usefulness. It's likely that "Peachtree Dunwoody Road" traverses multiple zip codes, and Google returns a pin at a geometric center for the road (try the search in Maps) but doesn't try to guess a zip code. Zip codes can be complicated and it's probably best not to make a guess unless the entire street is contained in one zip code. For instance, sometimes, the east side of a road has one zip code but the west side has a different zip code.
As for whether there is a workaround or not, I believe the answer is no. To illustrate, you might look at the SmartyStreets demo site and fill in the address components as much as possible. I just tried "Peachtree Dunwoody Road, Atlanta, GA, United States." While I was typing, SmartyStreets suggested the following three results:
Peachtree Dunwoody Rd, Atlanta GA
W Peachtree Dunwoody Rd, Atlanta GA
Peachtree Dunwoody Rd NE, Atlanta GA
Full disclosure: I worked for SmartyStreets, an address validation company.
Some location entries returned by the geocoder won't have postal_codes. The response for "Peachtree Dunwoody Road, Atlanta, GA, United States" is of type "GEOMETRIC_CENTER".
A "road" doesn't necessarily have a postal code (it isn't a postal address).
I saw zipcode 22222 is for Arlington, VA in United States but when search this from Google Map api it doesn't show me country name United States
http://maps.googleapis.com/maps/api/geocode/json?address=22222
Please let me know what I am doing wrong in here?
I tried with http://maps.google.com/maps/api/geocode/json?components=country:US|postal_code:22222&sensor=false
which gives no result that means United States doesn't have zipcode=22222
but on internet 22222 belongs to VA, US
Use zip_code not postal_code I think this returns the correct.
http://maps.google.com/maps/api/geocode/json?components=country:US|zip_code:22222
I have a list of latitude/longitude which point to some cities in England.
For each of these coordinates I want to get the region they belong to.
By region, I mean one of these: https://en.wikipedia.org/wiki/Regions_of_England
For instance: For coordinates (53.38112, -1.47008), ie. Sheffield, I need to find Yorkshire and the Humber.
To achieve this, I tried to use Google Reverse Geocoding API:
https://maps.googleapis.com/maps/api/geocode/json?latlng=53.38112,-1.47008&key=
Google then tells me that:
country is United Kingdom
administrative_area_level_1 is England, which is a State (or kind of)
administrative_area_level_2 is South Yorkshire, which is a County
administrative_area_level_3 is Sheffield District, which is a District
So Google returns me the correct State, County and District. However, Region is missing.
Is there any way to obtain it?
Looking at the documentation I don't think the Google API returns such information.
An alternative way to get round this would be to build a list of which counties belong in which of the 9 regions and then look up the region based on the county name. Obviously, this would be a bit of work on your part putting all the county names into a list.
While this doesn't directly answer your query, you could use a set of polygons which trace the regions and a point in polygon algorithm (this example is in PHP but the algorithm exists in many languages) which would allow you to check which of the regions any latitude and longitude is in
I have some markers on a map and when the user click them I use the google geocoder to get the address information. The issue is the format that Google returns this data. I want to display the address in a consistent format such as
Vancouver, British Columbia, Canada
Seattle, Washington, United States
Sydney, New South Wales, Australia
does any one know a simple way to parse this data so I end up with some nice simple json like
{"city":"Vancouver", "region":"British Columbia", "country":"Canada"}
Thanks.
Oh man, the days when I thought political geography was this simple were sweeter days. If Google could return data like this, they surely would. Instead you get a mess of locality, sublocality, administrative_area_level_*, country, etc.
To illustrate this, consider the following:
http://maps.googleapis.com/maps/api/geocode/json?address=11215&sensor=false
http://maps.googleapis.com/maps/api/geocode/json?address=10010&sensor=false
For Manhattan, you're in okay shape. You get the borough (Manhattan), the city (New York), the county (New York), and the state (New York). For Brooklyn, things aren't so clean. You get the borough (Brooklyn), the county (Kings), and the state (New York).
Now if you go a little ways out onto Long Island, you get more fun:
http://maps.googleapis.com/maps/api/geocode/json?address=40.723464,%20-73.716282&sensor=false
In this case you get the village (Floral Park), the town (Hempstead), the county (Nassau), and the state (New York), but everything is kind of muddled up.
This is the variation within 20 miles in one state. If you move out of that, you can count on even less. In the UK, what most of what we'd want to see as London, will be some smaller borough of Greater London.
Google provides a deep and rich taxonomy to deal with this variation, but you will still need to apply your own rules to make sense of it (often at the state by state and country by country level)