Google Maps - Follow Path Of Travel - google-maps-api-3

I am working with a security company that has a patrol car travel around a neighborhood. Every 30 seconds, they record a GPS coordinate/point which I can download and use. I'm trying to map a 'path of travel' for the patrol vehicle using Google Maps API.
I understand how to map (marker) all the points using the Google Maps v3 API. I also understand how I can do a driving route between a few points using directionsService. According to Google and StackOverflow, the maximum number of waypoints is 26.
The problem is that I have dozens of these points (1 hour = 120 points). I can't just draw a polyline between the points because I need it to show the path of travel on the actual street - not as the crow flies between 2 points. Also, I don't have 10K to purchase an Enterprise license.
Any ideas on how this might be accomplished or am I SOL? Can you draw 120 multiple 'routes' on the same map? Speed is not important here.
Thanks,
Mike

Can you draw 120 multiple 'routes' on the same map?
You can. When you want to draw the routes by using the DirectionsRenderer you must use a separate DirectionsRenderer-instance for each route.
Another approach: request the routes via the DirectionsService, but use a custom Polyline to draw the route. Each time you get a new route you'll only have to push the points of the new route to the path of the polyline.

Related

How can I draw a map with lines using Here?

I have some csv files of latitude/ longitude points and I want to draw some maps using Here.
Points,Latitude,Longitude
Start_Point,37.8279,23.80773
Point_7,37.83347,23.80042
Point_6,37.83374,23.80056
I want to be able to see the directions from point A to point B on road.
I have uploaded the csv via "Your Geospace" but seems like I don't have access to GPX traces on support layers. Is this available only when you upload GPX files?
Is there a way not to only draw the points on map, but draw the whole route. I want something like a travelling salesman problem.
We have HERE TCS examples page https://tcs.ext.here.com , https://tcs.ext.here.com/examples/v3.1/ where you can find how to develop your applications - just mouse right click on an example and select 'View page source'
We have RME API (Route Match Extension) where you can upload your GPS coordinates in CSV format: https://tcs.ext.here.com/examples/v3.1/rme_basic - this example makes a route match the points and calculate a route with showing on the map.
Travelling salesman problem you can resolve with HERE APIs:
HERE WSE API (Waypoints Sequence)
https://developer.here.com/documentation/routing-waypoints/dev_guide/index.html
HERE Tour Planning API - https://developer.here.com/documentation/tour-planning/2.3.0/dev_guide/index.html

HERE Maps Api Reverse Geocode and Street/Road Bearing

Using HERE Maps Api, for a geographic coordinate (lat, lng), I would like to find address information for the nearest routable road. Information that includes:
Address (street, house number, city, postal code, country)
Bearing/Heading of the road (0 to 360 degrees from True North)
How can I achieve this through HERE Maps API?
So far, this is what I have been able to achieve:
Calling the calculate Route API with identical start and end endpoints and mode=car will force the API to snap to the nearest routable point. This step is necessary for when the input coordinates are for a pedestrian street.
Using the nearest routable point coordinates, I can call reverse GeoCode API and I will be able to find the address information I need.
The next step is where I'm currently stuck. I'm able to find information like direction=NW, however I can't find the ~exact bearing in grad, for example bearing=265.
Is this achievable? Are 3 steps really necessary or is there a HERE Maps API endpoint that can provide all of this?
You can use the Fleet Telematics API to get the headings value for a particular road. Read more about the api here - https://developer.here.com/documentation/platform-data/topics/quick-start-view-map-data.html
You can also look at the field explanationshere - https://tcs.ext.here.com/pde/layer?region=WEU&release=19111&url_root=pde.api.here.com&layer=ADAS_ATTRIB_FC1
HEADINGS Horizontal road heading [10^-3 degree] at coordinate points along the link, when driving from Reference Node. Comma separated. Each value is relative to the previous. No values here for the ref/nonref nodes, because they are in the separate fields REFNODE_LINKCURVHEADS and NREFNODE_LINKCURVHEADS.

How to get Advanced Data Sets for only one gps point

I started exploring HERE maps few days back and I want to get road specify data (tunnel, bridge, overpass, underpass, speed limit) like the one returned using "Fleet Telematics Advanced Data Sets" after using specific layer. I see that this returns list of all the points that belong to particular tile.
But just want to for gps points that my path has and not on an area. Is it possible using any HERE maps api or any manipulations to the above API or any other WAR?
It is not possible to get road geometry for a single gps point buut rather for the link/road in which the gps point is. If you want to find get road geometry details for the links/roads of a particular route you can get it by using Fleet Telematics API. Adding "attributes=ROAD_GEOM_FCn(TUNNEL,BRIDGE)" can fetch you the details whether the road is a tunnel or a bridge etc. Hope this helps!
http://cre.cit.api.here.com/2/calculateroute.json?app_id=xxxx&app_code=xxxx&mode=fastest;truck;traffic:disabled&driver_cost=10&waypoint0=55.308989,10.805059&waypoint1=55.368920,11.288338&attributes=ROAD_GEOM_FCn(TUNNEL,BRIDGE)

Maps API is there a way to get available routes from A to B when they are the same?

So I want to find different walking routes where the start and end destination is the same. So If I as a user choose 5km, maps would show me routes that are about 5km long and start and ends at the same location. I have looked through the (messy) maps apis but haven't managed to find any endpoints for doing this.
You can do something like that by adding waypoints. So for a 5km walk you could generate a random point within 2.5 km of your start/end point and add it as a waypoint when generating directions.
Edit:
In addition you may try using the Geometry library in the Google Maps API. There is a computeOffset function which returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north). This way you can add some waypoints relative to the start/end point. Or in close proximity to the random first waypoint.
https://developers.google.com/maps/documentation/javascript/directions#Waypoints

Plotting routes with here.com api

I'm using the Here.com "maptile" api to populate my map with map tiles. Now I want to add routes from point A to B to the map. I figured Here's routing api would provide me with a nice set of coordinates to use for plotting a line in the map, but the api only provides one coordinate pair per "maneuver" (that is, at roundabouts, exits, intersections etc). That is not detailed enough to use for plotting routes since all roads are not perfectly straight ;)
Example
This example at Here's api playground shows a red route plotted perfectly along a road using their map image api. However, if you run the start and end coordinates in the "m1" field through the routing api, you will get the following coordinates:
52.5408395,13.2626364,52.5403011,13.2630944,52.5289285,13.2687593,52.51873,13.2800306
If you enter these coordinates in the "r1" field and click Send Request, you will see that the route is plotted differently (straight line across the park, instead of along the yellow road).
Question
Is there any way to get more detailed data from Here.com's routing api (or any other Here api I may have overlooked), suitable for plotting roads?
Or is there perhaps some way to get map tiles from the maptile api with a route properly pre-rendered?
In HERE Routing API, you can ask for route shape with parameter &routeattributes=shape
This will return an array of coordinates which represents the exact shape of the route on the road. You can also use pedestrian mode which will take into account the roads only accessible on foot.
Unfortunately it's not possible to get map tiles with rendered route shape using Map Tiles API. This API is just for fetching tiles.

Resources