http://project-osrm.org/ is used for "map matching", it is an algorithm that provides a "snap to road" functionality, without which tracked vehicles might appear that they travel off their designated roads.
- It is deployed on the
streamsheetsserver, 192.168.13.45, and accepts requets over HTTP on port 5000. - The data files are in
~/osrm.
OSRM requires map data to be prepared in advance, according to these instructions: https://github.com/Project-OSRM/osrm-backend
mkdir ~/osrm && cd ~/osrm- Download the latest map for Moldova from http://download.geofabrik.de/europe/moldova.html, typically it is a matter of
wget http://download.geofabrik.de/europe/moldova-latest.osm.pbf - Pre-process the data
docker run -t -v --rm "${PWD}:/data" osrm/osrm-backend osrm-extract -p /opt/car.lua /data/moldova-latest.osm.pbf docker run -t -v --rm "${PWD}:/data" osrm/osrm-backend osrm-partition /data/moldova-latest.osrmdocker run -t -v --rm "${PWD}:/data" osrm/osrm-backend osrm-customize /data/moldova-latest.osrm- After running these commands, many of the generated files are owned by root; it is better to change ownership to your own user
chown osrm:osrm ./*.*
- Run the server itself
docker run -t -i --rm -p 5000:5000 -v "${PWD}:/data" osrm/osrm-backend osrm-routed --algorithm mld /data/moldova-latest.osrm(note that the--rmflag ensures the container will be deleted after use; no worries - a new one will be created if you startosrmagain via docker) - Sending a test request
curl 'http://127.0.0.1:5000/match/v1/driving/28.8260977,47.0231816;28.8260977,47.0231816?radiuses=15;15', you should get a JSON response back.
This is done with systemd, see res/systemd-osrm.template for details. Pay attention to several sneaky differences between what is in the service template file and the commands above:
- absolute paths are used, so no
${PWD}in the service - no
-ieither, because the service doesn't provide an interactive console
sudo systemctl osrm start|stop|restartsudo journalctl -u osrm -f
- https://lists.openstreetmap.org/pipermail/osrm-talk/2019-December/001818.html - mailing list discussion about the feasibility of using OSRM for real-time streams.