12

I'm analysing the likely paths taken by commuters on their way to work, based on Census flow data, job density distributions and the transport network.

At the moment I'm using pgRouting and the pgRouting add-on for QGIS (described here) for my analysis:

routing in qgis

However, I'd like all the steps I take to be full replicable (see excellent article on this here), then I'd prefer to do my analysis from the command-line and save the script files for future reference.

R-geo packages fulfil this requirement well, as they are free, lightweight, and stable: download a tiny script file and you should be able to re-do all the things I have done (see here for an unrelated example of this on Rpubs).

The R packages I've identified for doing this are:

  • gdistance published December 2012, looks promising, but no sign of compatibility with osm transport networks
  • e1071 seems rather abstract and possibly overkill for what I want to do
  • pairdist.lpp function in spatstat package looks promising, but has little documentation

Before diving in to these, thought it worth asking people who may have faced similar dilemmas.

Is it possible to do my routing analysis in R, or would it be best to learn PostGIS properly and do it all in pgRouting?

10

Just to close this loose end, since I asked the question a new package was released called osmar which contains a vignette of how to implement shortest path algorithms in R using Open Street Map data: http://osmar.r-forge.r-project.org/ . It uses the function get.shortest.paths from the igraph package.

Excellent article on this can be found here: http://journal.r-project.org/archive/2013-1/eugster-schlesinger.pdf

And a tutorial by me can be found here: http://eprints.whiterose.ac.uk/77643/7/lovelace2.pdf

-1

I have used the package riverdist for similar applications. It was limited for what I wanted the use but it might be useful for other users.

I have also found this package stplanr that seems to do what you are looking for.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.