Hi there! I have collected bus GPS data and I want to draw a route of that bus according to that GPS data on a map. I tried to use available services that provide Directions API. But there I can either choose car, bicycle or pedestrian as a travel mode, and those services try to avoid some places, where the bus definitely goes, but it is either not allowed to driver there by car or the route under construction. Pedestrian type doesn't work for me because the services draw a route next to the road, but not over it. What I basically want is to draw a line on the road between multiple GPS points, but I don't want any "smart" functions that such services provide. Don't you have any suggestions how it can be done? E.g. get a pice of road where GPS coordinate point to. UPD: Here is the example how direction services draw a route and how it should be. Blue line is how the mapbox draws the route. Red line is where the actual route is located. asked 07 Apr '19, 17:16 RokrVPV |
You have two options:
answered 07 Apr '19, 23:38 Frederik Ramm ♦ That is an option, thanks! I'll need to dig into it.
(09 Apr '19, 20:02)
RokrVPV
Marking the answer as a correct. I was able to do that was suggested by @Frederik in the 2nd point. The only problem I see now is that when I set overview=full for route service, the points are a bit shifted from their correct location and don't point to roads, but next to it. But I am able to construct a route if use geometry from each step by setting steps=true in the request.
(01 May '19, 21:17)
RokrVPV
|
(answering the points in the comment "What I have is GPS coordinates...") Once you've added a bus route to OSM you'll be able to create a map that shows that bus route on it. The route will get added to OSM as a relation, and whatever you use to create a map will need to display that. See for example this example on the OSM website. It doesn't make sense to expect a router (foot, car, or bicycle) to follow a bus route. Depending on what sort of "map" you're creating you'll need to do something different to display relation data. I wrote this diary entry ages ago about doing it in a style similar to OSM's OSM Carto style. answered 07 Apr '19, 21:40 SomeoneElse ♦ |
Hi RokrVPV, you can do that in BaseCamp https://www8.garmin.com/support/download_details.jsp?id=4435 or in QMapShack https://bitbucket.org/maproom/qmapshack/wiki/Home There you can draw whatever you want, or even just import your Gpx trace, and print your map. What you want is not possible in Openstreet map. Here buroutes must follow established roads and not Gpx traces. You can use your Gpx trace only as a guide to edit the bus route. If the roads are not present yet, you have to draw those first from an opensource. Bus routes are not for the faint of heart though : https://wiki.openstreetmap.org/wiki/Buses Gys answered 07 Apr '19, 19:00 Gys de Jongh Thanks! I'll have a look at these tools.
(09 Apr '19, 19:59)
RokrVPV
|
Sorry, it's not immediately clear what your end goal is here and how it involves OpenStreetMap.
Are you trying to add a bus route to OSM and then create a map from that data that shows the route?
Are you trying to find a router that will get you from A to B using public transport data? That's unlikely to be OSM-based as although bus routes may be in OSM actual timetables won't be.
"Are you trying to add a bus route to OSM and then create a map from that data that shows the route?" - yes.
What I have is GPS coordinates of a bus that traveled along its route. Now I want to use these coordinates to draw a bus route. Finally, I would like to have an encoded polyline of the route so that later I could use this polyline to show the route on a map.
To achieve this, I tried several Directions API services like mapbox or graphhopper, but they don't always draw a route correctly, because some roads are not accessible by car. Instead, they try to navigate around such roads. I will upload picture to the post to show what I want.
I believe that OSM has stored roads as a data. So what I am thinking about now is e.g. try to get a polyline of a part of the road by GPS coordinate and then glue these polylines together to get the whole route. Or maybe there is a way to force such Directions services to draw what I want. I also know that OSM has bus routes, but they contain partially old or wrong data so I can't use it.