[OSRM-talk] Mapping 20,000 bike routes

Duccio Aiazzi duccio.aiazzi at gmail.com
Wed Mar 4 09:11:12 UTC 2020


Hi Chris,
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:

https://hub.docker.com/r/osrm/osrm-backend/

For R, I find the best package to manage the geometries is sf (
https://r-spatial.github.io/sf/index.html). 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.
Once you have your routes as LINESTRING geometries you can save them to
shapefile or gpkg with sf::st_write.

On Tue, 3 Mar 2020 at 13:03, <osrm-talk-request at openstreetmap.org> wrote:

> Send OSRM-talk mailing list submissions to
>         osrm-talk at openstreetmap.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.openstreetmap.org/listinfo/osrm-talk
> or, via email, send a message with subject or body 'help' to
>         osrm-talk-request at openstreetmap.org
>
> You can reach the person managing the list at
>         osrm-talk-owner at openstreetmap.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of OSRM-talk digest..."
> Today's Topics:
>
>    1. Mapping 20,000 bike routes (Chris Willer)
>    2. Re: Mapping 20,000 bike routes (Nathan Wessel)
>
>
>
> ---------- Forwarded message ----------
> From: Chris Willer <cwiller1 at kent.edu>
> To: osrm-talk at openstreetmap.org
> Cc:
> Bcc:
> Date: Mon, 2 Mar 2020 10:02:46 -0500
> Subject: [OSRM-talk] Mapping 20,000 bike routes
> Hi all,
>
> 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.
>
> Any help would be appreciated.
>
> Best,
> Chris
>
>
>
>
>
>
> ---------- Forwarded message ----------
> From: Nathan Wessel <nate.wessel at mail.utoronto.ca>
> To: "osrm-talk at openstreetmap.org" <osrm-talk at openstreetmap.org>, "
> cwiller1 at kent.edu" <cwiller1 at kent.edu>
> Cc:
> Bcc:
> Date: Mon, 2 Mar 2020 15:17:52 +0000
> Subject: Re: [OSRM-talk] Mapping 20,000 bike routes
>
> Hi Chris,
>
> 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.
>
> 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.
>
> You can check out some of my Python code here:
> https://github.com/Nate-Wessel/TO-bike-map/blob/master/between.py
> There is a shell script in there as well that shows how I start up OSRM
> and process the OSM data:
> https://github.com/Nate-Wessel/TO-bike-map/blob/master/update-streets.sh
>
> Hope that helps!
>
> Nate Wessel, PhD
> Planner, Cartographer, Transport Nerd
> NateWessel.com <https://www.natewessel.com>
> On 2020-03-02 10:02 a.m., Chris Willer wrote:
>
> Hi all,
>
> 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.
>
> Any help would be appreciated.
>
> Best,
> Chris
>
>
>
>
> _______________________________________________
> OSRM-talk mailing listOSRM-talk at openstreetmap.orghttps://lists.openstreetmap.org/listinfo/osrm-talk
>
> _______________________________________________
> 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/20200304/d419b1d0/attachment.htm>


More information about the OSRM-talk mailing list