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
Related
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
I'm just playing around with Here and this is my escenario for an idea.
Get a routing between 2 points, I know this is doable
Set the start and finish marker, I know this is doable
Get the distance between the 2 points, I know this is doable
Now, if the distance from point 1 and 2 is 3000 meters I want to set a marker ( You are here ) based on a arbitrary distance value, let say I want to add a marker at the 1750 meters point, the market should appears in the half route way.
Is this posible with the actual API?
Thanks in advance!
Yes it is possible to do with HERE javascript API.
Once you get routing response and create H.geo.LineString out of it, you can calculate distance between each two geo points from that line string using H.geo.Point#distance method. This will help to determine between which two points (lat, lng) is your desired arbitrary distance.
After that you need to calculate angle between these two geo points and use it in method H.geo.Point#walk in order to get exact position of the geo point you need.
Here you can find jsfiddle example which places marker on the simple LineString based on desired arbitrary distance.
Inbound https://maps.googleapis.com/maps/api/distancematrix/json?origins=Mount+Monodnak&destinations=Boston+MA
Outbound: https://maps.googleapis.com/maps/api/distancematrix/json?origins=Boston+MA&destinations=Mount+Monadnock
You can see that data is returned on the outbound leg to the mountain but not on the return back. Travel mode needs to be driving.
I Geocoded Mount Monadnock to get the latitude and longitude and tried the nearestRoad api call but that also returned {}
Here is the URL with my API key removed (but is required) roads.googleapis.com/v1/nearestRoads?points=42.8610804,-72.1083267&key=
A solution I am considering is to find the lat long bounds of the zip code area and find which point is closest to the destination to calculate distance and duration but that is obviously not ideal.
Any ideas or insight would be much appreciated, thanks.
I have heading that i get with this computeHeading(from:LatLng, to:LatLng), latlng of one point and distance to second point(in meters) is there a way using these three things to get latlng of second point ?
From google docs Navigation Functions
Given a particular heading, an origin location, and the distance to travel (in meters), you can calculate the destination coordinates using computeOffset().
App works this way:
User enters a starting location and a distance. User can choose to draw circles, or lines over the roads. Circles work fine. Lines used to work.
When Lines, the code finds the lat/long of the starting location, then for the points N, S, E, W of the origin at the distance set by the user (say, 100km). Starting with the N destination, the code calls google.maps.DirectionsService() to get directions from the origin to N. This returns an array of lat/longs in the the route.overview_path.
NOTE: I COULD use the directionsRenderer() to draw the route, BUT, the distance drawn would be greater than the distance set by the user. Drawing the entire route from the origin to the point N might be 124km over the roads, and I just want to draw 100km.
Instead, I step through the route.overview_path[] array, checking the distance between that point and the point of origin, adding each point to a new array. When the distance is greater than the dist set by the user, I stop, pop off the last element, then create a new Polyline based on this 2nd, smaller array.
I've spent the entire day in Chrome's developer mode walking through the javascript, setting breakpoints, watching locals, etc. The array of points passed in google.maps.Polyline({}) is a good array of unique points. I just cannot figure out why they aren't rendering.
Ultimately, the code used to draw 4 lines starting at the point of origin, one heading North, one heading East, South, West. etc....
The code is here: http://whosquick.com/RunViz.html
Thank you for your attention.
Nevermind. Solved it.
var objGeo = new LatLon(Geo.parseDMS(myroute.overview_path[0].Pa), Geo.parseDMS(myroute.overview_path[0].Qa));
I had inadvertently switched Pa with Qa.