<div dir="ltr"><div>Hi Chris,</div><div>As Nate mentioned, the best thing is to run your local copy of OSRM. I found the easiest way is to run a Docker image, you can find the back-end here:</div><div><br></div><div><a href="https://hub.docker.com/r/osrm/osrm-backend/">https://hub.docker.com/r/osrm/osrm-backend/</a></div><div><br></div><div>For R, I find the best package to manage the geometries is sf (<a href="https://r-spatial.github.io/sf/index.html">https://r-spatial.github.io/sf/index.html</a>). You will have to work a bit to put together the requests to the OSRM API and send it to the localhost and then you can parse the results with sf::st_read or manually. <br></div><div>Once you have your routes as LINESTRING geometries you can save them to shapefile or gpkg with sf::st_write.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 3 Mar 2020 at 13:03, <<a href="mailto:osrm-talk-request@openstreetmap.org">osrm-talk-request@openstreetmap.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send OSRM-talk mailing list submissions to<br>
<a href="mailto:osrm-talk@openstreetmap.org" target="_blank">osrm-talk@openstreetmap.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:osrm-talk-request@openstreetmap.org" target="_blank">osrm-talk-request@openstreetmap.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:osrm-talk-owner@openstreetmap.org" target="_blank">osrm-talk-owner@openstreetmap.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of OSRM-talk digest..."<br>
Today's Topics:<br>
<br>
1. Mapping 20,000 bike routes (Chris Willer)<br>
2. Re: Mapping 20,000 bike routes (Nathan Wessel)<br>
<br><br><br>---------- Forwarded message ----------<br>From: Chris Willer <<a href="mailto:cwiller1@kent.edu" target="_blank">cwiller1@kent.edu</a>><br>To: <a href="mailto:osrm-talk@openstreetmap.org" target="_blank">osrm-talk@openstreetmap.org</a><br>Cc: <br>Bcc: <br>Date: Mon, 2 Mar 2020 10:02:46 -0500<br>Subject: [OSRM-talk] Mapping 20,000 bike routes<br><div dir="ltr">Hi all,<div><br></div><div>I was wondering if anyone knows the best way to approach this project I'm working on. I have a csv file with 20,000 start and stop points for a bike share program. I'm trying to map the fastest bike route for each row. I program using R and am wondering how if anyone knows how to utilize OSM to map these routes and then extract them as shapefiles.</div><div><br></div><div>Any help would be appreciated.</div><div><br>Best,<br>Chris</div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><p style="margin:0in 0in 0.0001pt"><br></p><p style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br></p></div></div></div></div></div>
<br><br><br>---------- Forwarded message ----------<br>From: Nathan Wessel <<a href="mailto:nate.wessel@mail.utoronto.ca" target="_blank">nate.wessel@mail.utoronto.ca</a>><br>To: "<a href="mailto:osrm-talk@openstreetmap.org" target="_blank">osrm-talk@openstreetmap.org</a>" <<a href="mailto:osrm-talk@openstreetmap.org" target="_blank">osrm-talk@openstreetmap.org</a>>, "<a href="mailto:cwiller1@kent.edu" target="_blank">cwiller1@kent.edu</a>" <<a href="mailto:cwiller1@kent.edu" target="_blank">cwiller1@kent.edu</a>><br>Cc: <br>Bcc: <br>Date: Mon, 2 Mar 2020 15:17:52 +0000<br>Subject: Re: [OSRM-talk] Mapping 20,000 bike routes<br>
<div>
<p>Hi Chris, <br>
</p>
<p>I've done something similar in Python. I just run OSRM locally with the data built using the bike profile, and then make repeated http requests to localhost. Each request takes only about 5 milliseconds, so I haven't needed to parellelize yet. I'm running
~150k requests at a time and it takes a few minutes. <br>
</p>
<p>I believe you can request the output as geoJSON, so it's just a matter of parsing the geometry portion of the JSON data returned by OSRM and then exporting all that to whatever format you prefer.
<br>
</p>
<p>You can check out some of my Python code here: <a href="https://github.com/Nate-Wessel/TO-bike-map/blob/master/between.py" target="_blank">
https://github.com/Nate-Wessel/TO-bike-map/blob/master/between.py</a><br>
There is a shell script in there as well that shows how I start up OSRM and process the OSM data:
<a href="https://github.com/Nate-Wessel/TO-bike-map/blob/master/update-streets.sh" target="_blank">
https://github.com/Nate-Wessel/TO-bike-map/blob/master/update-streets.sh</a> <br>
</p>
<p>Hope that helps!<br>
</p>
<div>
<p>Nate Wessel<small>, PhD<br>
Planner, Cartographer, Transport Nerd<br>
<a href="https://www.natewessel.com" style="text-decoration:none" target="_blank">NateWessel.com</a></small>
</p>
</div>
<div>On 2020-03-02 10:02 a.m., Chris Willer wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi all,
<div><br>
</div>
<div>I was wondering if anyone knows the best way to approach this project I'm working on. I have a csv file with 20,000 start and stop points for a bike share program. I'm trying to map the fastest bike route for each row. I program using R and am wondering
how if anyone knows how to utilize OSM to map these routes and then extract them as shapefiles.</div>
<div><br>
</div>
<div>Any help would be appreciated.</div>
<div><br>
Best,<br>
Chris</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<p style="margin:0in 0in 0.0001pt"><br>
</p>
<p style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">
<br>
</p>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
OSRM-talk mailing list
<a href="mailto:OSRM-talk@openstreetmap.org" target="_blank">OSRM-talk@openstreetmap.org</a>
<a href="https://lists.openstreetmap.org/listinfo/osrm-talk" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a>
</pre>
</blockquote>
</div>
_______________________________________________<br>
OSRM-talk mailing list<br>
<a href="mailto:OSRM-talk@openstreetmap.org" target="_blank">OSRM-talk@openstreetmap.org</a><br>
<a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
</blockquote></div></div>