I use the Direction API to plot and save a route between A and B.
My application receives a coordinated car gps, I would like to
identify if the car is off course previously traced.
Anyone have any idea how to do this?
You may create a polyline based on the route and use google.maps.geometry.poly.isLocationOnEdge to check if the current coordinate is placed on/near the polyline.
For an approximate result create the polyline using the overview_path of the route, for higher accuracy use the lat_lngs of the steps of the route
Related
we started testing the Routing API in our system and there were some questions:
our goal is to calculate a route for a large truck, to determine whether it will be able to get to the delivery point, taking into account its dimensions and weight. We have formed a request according to the instructions. The request deliberately indicated the delivery point to which the truck would not be able to reach. We expected the route calculation to fail, but it did. We made other attempts with different addresses and got the same result - the route is calculated for the streets that are not passable. We did not find any information describing this behavior in the documentation. Tell me how we can achieve the desired result so that the route is not calculated if the street is not passable for a truck on the last mile?
An example of the request we tested:
router.hereapi.com/v8/routes?transportMode=truck&truck[grossWeight]=20000&truck[height]=300&truck[width]=245&truck[length]=1300&origin=44.65842,10.77567&destination=38.550680,15.938761&return=summary&apiKey=
Thanks in advance for your help
I am creating an iphone app, where I want to find out the store name from the latitude and longitude coordinates. Is there any such react native package that I can install ? BTW I am using expo platform.
Thanks,
You can use the Places API Nearby Search that is available on Google Maps Platform.
This API will let you search for places within a specified latitude and longitude. You can refine your search request by supplying keywords or specifying the type of place you are searching for.
For example in your case, you want to search for nearby "store" within 1500m radius of a point near Sydney, Australia: https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.865111,151.196121&radius=1500&type=store&key=YOUR_API_KEY
Here are the different Place Types you can use to refine your search request.
Please note that you will be needing an API key to authenticate each request to the API. Here is how you can get one: https://developers.google.com/places/web-service/get-api-key
I hope this helps!
I am having difficulty in overcoming the situation I am facing. I have a route as follow:
StartPoint
WayPoint A-1 <--- Pickup
WayPoint A-2 <--- Dropoff
WayPoint B-1 <--- Pickup
WayPoint B-2 <--- Dropoff
WayPoint C-1 <--- Pickup
WayPoint C-2 <--- Dropoff
EndPoint
A bus is starting to drive from Start Point and it is supposed to pick 3 passengers up (A, B, C) and drop them off in different locations. The locations are not static and it changes based on passenger.
If I pass all these to google map directions api and set the OptimizeWaypoint option to true the issue that occurs is sometimes the dropoff waypoint occurs before pickup waypoint for a passenger due to route optimization.
Does anyone know a solution to force google map api route optimization to always have pickup before the dropoff for each passenger please?
I appreciate all your help in advance guys.
I have found a solution to my problem after 3 days of research. The solution is not through Google Map API and it's using a third party API called RouteXL. They are providing an API which does such this thing I am looking for. Here is the link to documentation although their documentation is not clearly documented but it has helped me to work it out.
https://www.routexl.nl/blog/api/?lang=en#post-tour
The function which I needed was the Tour Post and that does what I exactly needed.
If anyone needs any help on this I am happy to help.
I hope this helps everyone else.
Thank you all for the help.
The waypoint optimization feature in Google Maps is limited to basic travelling salesmen scenarios in which all the waypoints are re-ordered to find the optimal route. What you are looking to do falls under the category of Vehicle Routing problem, more precisely the Vehicle Routing Problem with pickup and delivery. Google doesn't provide a service for this. However, there are some open source algorithm available for this. Here are a few:
https://github.com/pgRouting/pgrouting/wiki/VRP%20Pickup%20Delivery%20Problem
https://github.com/graphhopper/jsprit
https://github.com/mck-/Open-VRP
Most of these use straight line distances to generate a distance matrix between your locations which are then used within the algorithm. For better accuracy you may want to use a distance matrix service that based on travel time. For even more accuracy you may want to take a look at the Bing Maps distance matrix service which also provides the option to generate a distance matrix over a period of time intervals for a day which would fluctuate based on predictive traffic conditions.
I need to fetch the list of latitude and longitudes of a complete route to be used by pedestrians. I know i can get route segment points using the Google Directions API but problem comes when there is a turn in the route. I need very accurate direction navigation at step by step accuracy.
Thanks in advance.
Regards,
Wahib
Yes: it looks so messy to write script(Maybe it is answered only for display)
Please check minimum(j:p) of:
distance(result.getDirections().routes[0].legs[0].steps[s].startpoint,
result.getDirections().routes[0].overview_path[p]);
I wanted to know what is the basic difference between a GPX track and route file
A route is a sequence of waypoints, its the plan for your navigation. A track is the recorded path you did actually follow while trying to implement the plan (the route).
As GPX files a different XML schema is used for routes and tracks. Here are examples: http://cycleseven.org/gps-waypoints-routes-and-tracks-the-difference
Originally, a GPX route was supposed to consists of only waypoints important to navigate along them from origin to destination, still allowing differences in the actual track taken due to, for instance, traffic conditions or construction sites. Hence, the GPX track was supposed to consists of a much more dense sequence of actually recorded locations on the way from waypoint to waypoint. A pretty good scheme can be found on Wikipedia.
Since Stefan's link is broken, you will find the latest official GPX definition and documentation at topografix.com.
However, GPX tracks are sometimes used for all purposes: planning tours, navigating (particularly when cycling or hiking) or recording the actual track.
I participate in a cycling group (San Jose Bike Party) that routes a course each month which you can download as a GPX Track or GPX Route. When I upload them into my fitness app (Strava), you can see the difference between a GPX Track and a GPX Route.
Note that the GPX Track contours the roads for the exact route they recorded, but the GPX Route only notes the point-to-point linear segments between the sparse points they recorded. It's up to you or your navigation router to determine how to get from point to point in the GPX Route.