google map and api shows different results - google-maps

I am surprised whether i am doing any wrong or not. When i am finding the distance between two locations on google maps say maps.google.co.uk and when i query their API i get different result. Am i missing somethng?
Origin:Hyde Park Corner Station, Knightsbridge, London, United Kingdom
Destination:The Ritz London, United Kingdom
Result: 1.2 miles
And when i am using api:
http://maps.googleapis.com/maps/api/directions/json?origin=Hyde%20Park%20Corner%20Station,%20Knightsbridge,%20London,%20United%20Kingdom&destination=The%20Ritz%20London,%20United%20Kingdom&region=gb&sensor=false&alternatives=true&units=imperial
Result:4.3 miles or 5.0 miles etc.
Why is there so much of difference . Am i missing something.

There are significant differences between Google Maps and a service like directions(or geocoding)
Google Maps at first is an implementation of Google Places, and that's the issue here. The directions-service uses geocoding to resolve the addresses, while Google Maps uses the PlacesService.
When you draw the route using the directionsRenderer, you will see that there are different start-and end-locations.
But when you first request the PlacesService to get the coordinates of the places, and use these coordinates to request the directionsService, you will get a result near by the result of Google Maps(the duration may differ, because the directionsService by default will not return results depending on the current traffic)

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 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)

Why do I get different result from geocode api vs google maps

I am new to google geocode API but I am planning to use the free version to get map coordinates for nearby golf courses. I started with my home course:
http://maps.google.com/maps/api/geocode/json?address=Karlstad+golfklubb
Plus "&key=[my generated api key]"
I get a result with status="OK" but the resulting long/lat is not correct. It's near but misses with 7-8km.
When I use maps.google I get correct location. Searched for "Karlstad golfklubb".
https://www.google.se/maps/place/Karlstad+Golfklubb/#59.4346545,13.5140563,17z/data=!3m1!4b1!4m2!3m1!1s0x465cb41aca8c1467:0x64836d18f18df2f6
Why do I get different geo locations when using the same keywords. Do they operate on different databases or do I need to enter more params?
I also tried with other nearby courses like "sommarro" and "bryngfjorden" but for they I get zero result. But no problem finding them in google maps.
If you look at the JSON code, they describe the formatted_address as
"formatted_address" : "Karlstad Golfbanan Jako, 652 30 Karlstad, Sweden"
Which if you enter into Google Maps shows the correct longitude and latitude in the JSON.
https://www.google.com/maps/place/Karlstad+Golfbanan+Jako,+Sweden/#59.3602394,13.472185,17z/data=!3m1!4b1!4m2!3m1!1s0x465cb23bc0f46911:0x66ceae446bdc95dc

Find neighbors delimitations with google maps or google api

I need to find points that define delimitations of neighbors from Chicago.
My question is: How can I find a list with latitudes/longitudes of all the points that delimit neighbors. For example:
Gold Coast from Chicago is a polygon with 6 points as seen on google map: http://maps.google.com/maps/ms?ie=UTF8&t=m&vpsrc=6&source=embed&oe=UTF8&msa=0&msid=206241844247425110008.0004b43f0262868b8037f
What is the best way to extract this points so I can draw poly-lines over google map with google API for specific neighbors?
Edited:
So with addresses, which you already have, you can create a Maps API site:
http://code.google.com/apis/maps/
and use the Geocoding API to get the latitude and longitude of each of the addresses.
Added: Seems based on your comment that you're looking for neighborhood boundary data. Google Maps doesn't provide that data. There are different venders that do, one I have heard of is the Zillow Neighborhood API. I have never used it so I don't know much about it.

Google Maps API (Google Directions) not working for particular location

While I m trying to draw a route for multi locations using google Map API, the route not available for some locations so the google maps not returning the map. I got the same result while trying by using the lattitude and longitude. One such location is orchha in uttarpradesh India to Delhi.
Driving directions is not yet officially supported in India. See this spreadsheet of supported features by country, so you might expect some inconsistencies.
Despite that, some directions requests work in India, for example most individual towns in Uttar Pradesh work. Perhaps the problem is that the geocoded point for Uttar Pradesh happens to be at a very blank area of farmland with no roads nearby. There's a limit to how far from a road a location can be for GDirections to work.