Maps.google.com and Google Maps V3 API geocoder gives different results - google-maps

I have the following address "12635 SCARSDALE ST, SAN ANTONIO, Texas 78217". If I enter this address in maps.google.com, it gives me the correct address. If I use the Google Maps V3 API geocoder ( http://maps.googleapis.com/maps/api/geocode/xml ), it returns a lat/long in scarsdale dr, Austin, tx( partial match). I used http://gmaps-samples-v3.googlecode.com/svn/trunk/geocoder/v3-geocoder-tool.html as well and it gets the same results.
Usually when this happens, it is something in the address( wrong zip code, misspelling etc).
I cannot see what could be wrong here or why the inconsistency. Any Ideas would be appreciated.
Note: Mapquest on the other hand does return the correct lat/long for this address.

It looks like you found an error in Google's data. Google has identified this location as "12635 Scarsdale, San Antonio, TX 78217" (note the missing ST portion of the address).
Their API is probably relying on proximity to find the closest match to the data provided (i.e. what is the closest "12635 Scarsdale" to San Antonio, TX)
You could help them (in this instance) by clicking the Send Feedback link in the bottom right corner of the map.

Related

A discrepancy when locations are retrieved from Geocoding API and Google maps

I have encountered a discrepancy between Geocoding API and Google maps when checking the same locations.
I tried the following locations in Google maps:
33 Place Massena, 06000 Nice, France (as the start location)
Gare de Nice Ville, Avenue Thiers, 06000 Nice France (as the destination)
The distance is between 1.7 and 2.2 km.
However, when I used Google maps and replaced the above destination with its Geocoding API, the distance is 3.7 km
The API I used is in the following link: https://maps.googleapis.com/maps/api/geocode/json?address=Gare%20de%20Nice%20Ville,%20Avenue%20Thiers,%2006000%20Nice%20France
Please see the attached pictures for further references.
Could you please check and let me know why it is different?
I think this is intended behavior, you should understand the difference between applying the address string and applying the coordinate.
When you apply the address string 'Gare de Nice Ville, Avenue Thiers, 06000 Nice France' the directions service will geocode it to the establishment with place ID ChIJnfu2MAbQzRIR1aBedCqfGXA.
https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3DGare%2520de%2520Nice%2520Ville%252C%2520Avenue%2520Thiers%252C%252006000%2520Nice%2520France
In this case the directions service will use an access point defined for this establishment. Looking at your screenshots I guess that the access point for this establishment is like shown in my screenshot
If you apply the coordinate 43.704612,7.261933 the directions service will just snap it to the nearest road. Something similar to the following request
https://roads.googleapis.com/v1/snapToRoads?path=43.704612%2C7.261933&key=YOUR_API_KEY
The result of the snapping to the road is shown in the following screenshot
As you can see the snapped point and the access point for establishment are different. I suppose that there are certain turn restrictions that doesn't allow to use Avenue Thiers to reach the snapped point and you make a big detour via Voie Pierre Mathis in this case.
I hope my explanation solves your doubts!

Google Directions API Travel Mode TRANSIT not working for street_address

Apologies if I'm writing obvious question.
Though I cannot find document anywhere online so I have decided to ask here.
Is it the case that transit mode in Goolge Directions API is only valid if origin and destination are point of interest?
If either or both address is type street_address, I am not able to receive response containing travel_mode=TRANSIT.
What I want to achieve from the API is a result like Google Map, where it outputs optimistic route between the origin and destination; consisting waypoint(s) of public transport in the middle of the trip.
E.g. Point of Interest to Point of Interest returns fine
https://maps.googleapis.com/maps/api/directions/json?origin=Wynyard%20station&destination=Chatswood%20station&mode=transit&transit_mode=rail&key=[key]
E.g. Point of Interest to street_address returns ZERO_RESULTS
https://maps.googleapis.com/maps/api/directions/json?origin=Wynyard%20station&destination=441%20Victoria%20Avenue&mode=transit&key=[key]
E.g. Inserting "Wynyard Station" as origin and "441 Victoria Avenue" as destination in Google Map returns route including both transit and walk to the destination.
The issue with your request is that you are using incomplete address string '441 Victoria Avenue'. This is really ambiguous query. If you check it in Geocoder tool, you will see that this string is resolved to '441 Victoria Ave, Forrest City, AR 72335, USA'
https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D441%2520Victoria%2520Avenue
So, you try to find a transit (train) directions between one place in Australia and another one in the USA.
ZERO_RESULTS is expected in this case. You should specify a more precise address string or use autocomplete to search transit directions using place IDs.
https://developers.google.com/maps/faq#geocoder_queryformat
https://developers.google.com/maps/documentation/geocoding/best-practices
For example, using '441 Victoria Avenue, Sydney' I can get transit directions
https://maps.googleapis.com/maps/api/directions/json?origin=Wynyard%20station&destination=441%20Victoria%20Avenue%2C%20Sydney&mode=transit&alternatives=true&transit_mode=train&key=YOUR_API_KEY
You can check this in Directions calculator tool:
https://directionsdebug.firebaseapp.com/?origin=Wynyard%20station&destination=441%20Victoria%20Avenue%2C%20Sydney&mode=transit&alternatives=true&transit_mode=train
Hope it helps!

Google Directions API Result is different from Google Maps result

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)

How to solve the Difference between Google Maps and Geocoding?

OK here is an odd situation. This I have been facing from long time on so many Maps I have created.
Here is one sample address :
Hotel Tamisa Golf, Camino Viejo de Coín, 3, Mijas Costa, Málaga, 29649 , Spain
If we go to
maps.google.com
and search this address, it comes to the exact Hotel Tamisa Golf.
But if we use Google Map's Geocoding method using this Example provided By Google themselves, and search this address over there, it is showing totally different location. Some miles away from actual location.
http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html
Is there a way to fix this so that is should show the Exact location on Map?
That "address" is a "place" not a "postal address".
The geocoder finds the coordinates associated with a postal address, looks like it thinks the address is "Urbanización Mijas Golf, 13S, 29651 Mijas, Málaga, Spain":
geocode
The places API finds "places": place
For the address you mentioned, the geocode is returning more than one results, you need to handle all the results. see your answer here.
EDIT:
The Google Place search API can help you here, for more detail see this.
Sample example is here at jsFiffle.

Google reverse geocoding - how to snap to nearest full postcode

I am using Google's reverse geocoding functionality with the maps api v3 to retrieve postal addresses for latitude longitude (when dragging a marker around a map).
This is a UK application only, and part of the system requires a full, or near full, postcode to process correctly. However the reverse geocoder regularly returns just the part of the postcode - for example "GU3", even when the actual address returned appears to be complete - for example including street and house number.
Is there anyway, preferably google but otherwise if not, of 'snapping' the address to the nearest full postcode?
I'm aware similar functionality exists for snapping to the nearest panorama view, but there appears to be no equivalent for postcode.
The UK post code database is available for download from the Ordnance Survey open data
www.ordnancesurvey.co.uk/opendata
Alternatively you can use a service like uk-postcode.com to return the closest post codes to a location
See the example at https://google-developers.appspot.com/maps/documentation/javascript/examples/geocoding-reverse
Try a UK location like 51.436951, 0.058112.
The results include an address_component of postal_code, "SE9 3AG".
It may be necessary to geocode the address you're given and then reverse-geocode the results in order to get the postcode. But it is possible.