Google Distance Matrix API "Error in Location" - google-maps-api-3

In the Google Distance Matrix API when calculating some driving/walking distances in Haiti, some of the coordinates that I provide (which were obtained from Geohack data) were not being identified by the distance matrix API and agives me a result that states “Error in Location”.
A few of the coordinates that are not identified by the Distance Matrix API are listed below.
Commune de Mont-Organisé -71.783333 19.4
Commune de Carice -71.833333 19.383333
Commune de Vallières -71.917 19.433
Commune de Môle Saint Nicolas -73.383333 19.8
The search returns an error that states, "Error in Location" when any of the above coordinates are listed as one of the start/end points. Why does the distance matrix API not identify some coordinates such as the above? Apart from attempting to use alternative coordinates is there another way to resolve this issue?

The API doesn't need to "identify" a coordinate, a coordinate is a fixed value.
You can't assume that google is able to calculate a route from/to each location in the world.

Related

Can I restrict geocode results to a specific state in R?

I'm using the ggmap geocode with the Google maps API. I have vector of city names in Ohio (city), and I am trying to return coordinates for each of these cities. My code,
coordinates <- geocode(city)
Is mostly returning the correct coordinates, but many of the city names in Ohio are the same as those in other states, so I'm receiving a few incorrect coordinates. Is there an argument I can add to "geocode" so that it only returns coordinates from Ohio?
Thanks!

Why is prox parameter value not enforced in 6.2/reversegeocode?

Why does the 6.2/reversegeocode API call not limit the results according to proximity parameter prox?
Example:
https://reverse.geocoder.api.here.com/6.2/reversegeocode.json
?app_id=my_app_id
&app_code=my_app_code
&maxresults=10
&mode=retrieveAddresses
&prox=53.468052,-113.44846,50
Partial result includes this record:
{
"Relevance":1.0,
"Distance":82.2,
"MatchLevel":"houseNumber",
...
"MatchType":"interpolated",
...
"Address":{
"Label":"125 Lee Ridge Rd NW, Edmonton, AB T6K 0N1, Canada",
...
}
}
So my requested radius is 50m, but the distance to one of the results is 82.2.
Why?
For Geocoder API v6.2 three aspects come into play here:
For performance reasons, distance filter does a simplified (plane triangular) distance calculation only, which for the higher latitude might be deviating from the real distance (spherical calculation)
The returned distance is calculated towards the display point and might differ from the filtering distance which is the nearest of display or navigation point
Reverse Geocoder v6.2 uses a link-based spatial index only,meaning that radius is used to select nearest links within radius and from those
the nearest point-address or otherwise housenumber range interpolated house number is returned.
I would suggest using the new Geocoding & Search API (https://developer.here.com/documentation/geocoding-search-api/dev_guide/topics/endpoint-reverse-geocode-brief.html) Reverse Geocoder, results are a bit more predictable and better understandable:
https://search.hereapi.com/v1/revgeocode?limit=20&in=circle%3A53.468052%2C-113.44846%3Br%3D50&apikey=YOUR_API_KEY

here-api - calculateroute distance

I am new to here-api and have a question wrt distance as shown in the response to a calculateroute request. Having a sequence of 100 waypoints recorded by GPS device along a road (~ 20m apart) the distance in the summary tag of the response is very different from what I calculate when summing up the distances between waypoints involved. Also bringing the waypoint sequence to a map shows that the summed up value is close to reality. whats going wrong here?
When sending a request like this
https://route.api.here.com/routing/7.2/calculateroute.json
?app_id=<my_app_id>
&app_code=<my_app_code>
&wayPoint0=geo!45.008503,7.555000
&wayPoint1=geo!45.006691,7.554025
&wayPoint2=geo!45.006470,7.554040
&wayPoint3=geo!45.006290,7.554018
&wayPoint4=geo!45.006096,7.553948
&wayPoint5=geo!45.005875,7.553872
&wayPoint6=geo!45.005615,7.553765
&wayPoint7=geo!45.004444,7.553305
&wayPoint8=geo!45.004116,7.553172
&wayPoint9=geo!45.003792,7.553035
&wayPoint10=geo!45.003460,7.552888
&routeattributes=routeId,waypoints,shape
&mode=shortest;car;traffic:disabled&returnelevation=true
I get a response consisting of 11 waypoints and 78 shapepoints. Calculating the distance via waypoints (using Haversine formula) yields a value of ~ 600 meters which looks reasonable and can be verified when exporting the result to kml and put on a map. However the distance tag under the summary section reports a distance of 3000 meters. Also the summed distance over shape points is much too high (2900m).
Most likely your GPS probes are not exactly on the road and calculateroute will compute a complex result.
When having a list of GPS tracks, you should use instead Route Map Extension (RME) that will figure out the correct/most probable route.

Calculating elevation using mathematical formula

Does anyone know how to calculate elevation using lattitude and longitude. By calculation I mean formula to calculate it manually. Other than using lattitude and longitude is there any other way to find elevation from any other parameters ?
EDIT 1
To be more specific regarding my above question other than using Elevation API provided by Google is there any way we could calculate elevation using any data from GPS of device.
Also Is it possible to calculate elevation from altitude..?
No, it is not possible to derive elevation from altitude or longitude or latitude or any combination of those things.
There are different ways to look at this problem, and I wouldn't say it is impossible.
If the surface elevation model is represented by an equation, such as with spherical harmonics, you could compute the elevation from this model, given a tuple of latitude and longitude.
You could also precompute the elevations on an appropriately sized grid and look up the values as is done in this answer.

how to get the direction of a location in google map api

i want to get the Direction of location in lati longi
when i use google map api
then he return me lati long for city (27.19, 78.01) but i need position too
means N E W S how i can get them too like
(27.19 N , 78.01 E).
N for north and E for east. how i can get the flank or direction too.
If the latitude returned by Googles Maps API is a positive number, then it is N. If it is negative, then it is S.
If the longitude is positive, then it is E. If it is negative, then it is W.
One can easily calculate distance between two location with the help of Google Map APIs. Google Map APIs comes with a set of classes which helps in doing such tasks.
class GDirection, helps in getting the travel distance between the two different location.
check following link for its example :-
http://tajendrasengar.blogspot.com/2011/09/distance-between-two-locations-with.html

Resources