[OSRM-talk] Map matching for live data-streams, one point at a time
Daniel Patterson
daniel at mapbox.com
Sat Dec 7 00:02:34 UTC 2019
Hi Alex,
If you simply want to find the nearest road to a GPS coordinate, the
/nearest service is simpler. The /match service is specifically designed
to match a sequence of GPS coordinates *with error* to the most likely path.
The problem with using /nearest is that it has no context - if your GPS
position has a large error value (10+ metres), then it may snap you to some
nearby road that's not actually where the vehicle is.
The /match service fixes this - if you supply, say, the last 60 seconds
of coordinates, it will use the prior coordinates to select the most likely
path, and snap the final coordinate to what is probably the right location,
even if there is some error in the GPS value.
For your specific case - the "NoSegment" error means there was no road to
snap to within 15m of the coordinates - either the OSM map is bad, or your
GPS coordinates have quite a large error in them. Adding `radiuses=15m`
increases the search range out to 45m (the 15m value is 1 standard
deviation of expected error, we search out to 3 standard deviations).
1. Yes, OSRM is suitable for this, if you use the /match service as I
suggested (provide several previous points for context).
2. No, but see description above. Supply a trace to /match, and look at
the last value in the result for the "current" point.
3. You'll have to test - I'd guess based on your description that the
last 6 samples would work pretty well.
4. It could handle 50 req/sec as long as you:
1. Give it sufficient CPUs to work with
2. Don't supply *too* many coordinate to /matching, and keep the
`radiuses=` parameter to the smallest value that works
3. Test it to determine throughput.
50 req/sec is not out of the question at all.
5. See above
6. If you can be confident about the routes, then you can reduce the size
of your map data (and increase matching performance) by giving OSRM a very
limited road network to work with (just your bus routes). You'd need to
figure out how to construct that yourself however, and ensure that all
roads are properly connected. The advantage to using the whole city is
that it will properly follow any deviations from the normal route.
If you can come up with a road network of just your bus routes, you
can increase the `radiuses=` parameter significantly so things would still
properly snap even in the case where a bus deviates from a route.
Hope that helps.
daniel
On Fri, Dec 6, 2019 at 3:16 PM Alex R <ralienpp at gmail.com> wrote:
> Hi,
>
> I ask for advice in using OSRM with a live stream of data. The examples
> I've seen relate to tracks that can be passed into OSRM and it will apply
> "map matching" to snap all points to the roads, in one move.
>
> My scenario is different, I am trying to understand whether it is
> feasible with in circumstances:
> - a fleet of 500 public transport vehicles
> - each vehicle sends telemetry every 10s
> - all of this is happening within a 120 km^2 city
> - the vehicles move on fixed routes that I know in advance
>
> I followed the Docker guide instructions and downloaded the map data for
> my country, then I sent a HTTP request to the matching API, with one
> data-point (note, in the examples below, the order is lon/lat, as mentioned
> in the FAQ):
> curl 'http://127.0.0.1:5000/match/v1/driving/28.8260977,47.0231816'
> OSRM replied with "Number of coordinates needs to be at least two."
>
> So I did: curl '
> http://127.0.0.1:5000/match/v1/driving/28.8260977,47.0231816;28.8260977,47.0231816
> '
> and got {"message":"Could not find a matching segment for any
> coordinate.","code":"NoSegment"}
>
> What worked out in the end was:
> curl '
> http://127.0.0.1:5000/match/v1/driving/28.8260977,47.0231816;28.8260977,47.0231816?radiuses=15;15
> '
>
>
> My questions are:
> 1. Is OSRM's matching suitable for such scenarios?
> 2. Did I correctly understand and apply the matching API?
> 3. What is the recommended number of points for a match query?
> 4. In what circumstances would it be able to handle a rate of 50
> requests/s?
> 5. What techniques can I apply to increase throughput?
> 6. Instead of using the map of an entire country, or even a city - can I
> tell OSRM to match to a specific route that I know for sure the vehicle is
> on?
>
>
> I look forward to your to your feedback,
> Alex
> _______________________________________________
> OSRM-talk mailing list
> OSRM-talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20191206/fadfe715/attachment.html>
More information about the OSRM-talk
mailing list