[pgrouting-dev] pgRouting 3 questions

Hi Devs,

I have three questions today.

1) I would like pgrouting to be aware of one-way streets.
I have read the page “How to handle one-way streets” but it has left me wondering, am I supposed to manually identify and label every one way street in my database?
This is obviously not practical. Is there a tool for importing OSM data into PostGres that auto assigns one way streets a reasonable reverse cost value?
I used osm2pgrouting when I imported my data, both the cost and reverse_cost fields seems to be set to st_length(the_geom).
This generates paths which go backwards around roundabouts, this is very dangerous :slight_smile:
Screenshot-22.png

2) I am interested in buses so I do not want any of my shortest paths to include (pedestrian or bike) ways.
I am using the wrapper function dijkstra_sp_directed, is there a way to tell this function to ignore ways that are of type pedestrian or bike.

3) pgRouting comes with some useful wrapper functions but it seems to me that it is missing one very useful one.
Why does pgRouting not ship with a function that calculates shortest paths from two (lon, lat) pairs?
Both myself and Daniel have written functions that do just this.
Daniel: http://websi.openvrp.com/
Cathal: http://ncg.nuim.ie/i2maps/projects/sp/index.html
I am not familiar enough with plpgsql to convert my code from Python but if someone else wanted to do it then I would be very happy to see this shipped with pgRouting.

Kind regards,
Cathal

Screenshot-22.png

Hi Cathal,

The subject of your today’s email is maybe not the best selection :wink:
You can also send three emails with one question each.

2011/4/15 cathal coffey <coffey.cathal@gmail.com>

Hi Devs,

I have three questions today.

1) I would like pgrouting to be aware of one-way streets.
I have read the page “How to handle one-way streets” but it has left me wondering, am I supposed to manually identify and label every one way street in my database?

You can also try osm2po (osm2po.de) to import OSM data. It’s fast and adds several useful attributes to the table. It’s not Open Source license though, but it’s free to use.

2) I am interested in buses so I do not want any of my shortest paths to include (pedestrian or bike) ways.
I am using the wrapper function dijkstra_sp_directed, is there a way to tell this function to ignore ways that are of type pedestrian or bike.

You just select the data you need. That’s it.
You need to modify wrappers or need to use the core functions if you want to have full control over what you want to select and what you don’t want to select.

3) pgRouting comes with some useful wrapper functions but it seems to me that it is missing one very useful one.
Why does pgRouting not ship with a function that calculates shortest paths from two (lon, lat) pairs?
Both myself and Daniel have written functions that do just this.
Daniel: http://websi.openvrp.com/

It wasn’t me, it was Anton, who wrote the wrappers.

The reason why there are not more wrappers available on the website is simple: nobody shares them :wink:
There might be several reasons for that, for example:

  • it’s too much to share them and contribute (we hope we made this easier by migrating to Github)
  • they are made for a certain data provider or a specific use case

Cathal: http://ncg.nuim.ie/i2maps/projects/sp/index.html
I am not familiar enough with plpgsql to convert my code from Python but if someone else wanted to do it then I would be very happy to see this shipped with pgRouting.

It’s nice that you share your experience and code. Maybe a tutorial about how to write a wrapper would help a lot of users. Any volunteer is welcome!
The library itself should be universal and work for any network data though. It’s important to keep this in mind.

Daniel

Kind regards,
Cathal


pgrouting-dev mailing list
pgrouting-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-dev


Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: http://georepublic.de

On 4/15/2011 6:39 AM, Daniel Kastl wrote:

It wasn't me, it was Anton, who wrote the wrappers.

The reason why there are not more wrappers available on the website is
simple: nobody shares them :wink:
There might be several reasons for that, for example:

    * it's too much to share them and contribute (we hope we made this
      easier by migrating to Github)
    * they are made for a certain data provider or a specific use case

    Cathal: http://ncg.nuim.ie/i2maps/projects/sp/index.html
    I am not familiar enough with plpgsql to convert my code from Python
    but if someone else wanted to do it then I would be very happy to
    see this shipped with pgRouting.

This question has been asked in the past. Basically the thought was to provide some sample wrapper functions that people would use as a template for building their solutions. While there are some common features that would be nice to have in the generic wrapper functions like trim the segments to the start and end points and being able to enter two lat/lon's, many of the customizations are problem specific and would not be valuable to others because they are solving a different problem or their data tables are different.

A good example is filtering pedestrian and bicycle ways from your bus routes. Oh and I don't use OSM data so anything OSM specific would get in my way. But there could be a collection of OSM specific wrappers that would be very useful to others working with OSM data.

For example I write new wrappers for almost every project I do because of these differences. IE: my existing wrappers do not fit the current problem I am trying to solve.

I think we would all agree that getting some of the common changes that everyone uses would be useful.

-Steve

On Apr 16, 2011 2:40 AM, “Stephen Woodbridge” <woodbri@swoodbridge.com> wrote:

On 4/15/2011 6:39 AM, Daniel Kastl wrote:

It wasn’t me, it was Anton, who wrote the wrappers.

The reason why there are not more wrappers available on the website is
simple: nobody shares them :wink:
There might be several reasons for that, for example:

  • it’s too much to share them and contribute (we hope we made this
    easier by migrating to Github)
  • they are made for a certain data provider or a specific use case

Cathal: http://ncg.nuim.ie/i2maps/projects/sp/index.html
I am not familiar enough with plpgsql to convert my code from Python
but if someone else wanted to do it then I would be very happy to
see this shipped with pgRouting.

This question has been asked in the past. Basically the thought was to provide some sample wrapper functions that people would use as a template for building their solutions. While there are some common features that would be nice to have in the generic wrapper functions like trim the segments to the start and end points and being able to enter two lat/lon’s, many of the customizations are problem specific and would not be valuable to others because they are solving a different problem or their data tables are different.

A good example is filtering pedestrian and bicycle ways from your bus routes. Oh and I don’t use OSM data so anything OSM specific would get in my way. But there could be a collection of OSM specific wrappers that would be very useful to others working with OSM data.

For example I write new wrappers for almost every project I do because of these differences. IE: my existing wrappers do not fit the current problem I am trying to solve.

I think we would all agree that getting some of the common changes that everyone uses would be useful.

I think it would be nice to have a collection of wrapper examples to learn from. Some recipies or code snippets to start with maybe.

Where do you think would be a good place for that?
The Github Wiki, the pgrouting-contrib repository or somewhere else?
If someone has a time and wants to study plpgsql, writing some recipies and tutorials and share them with the community would be for sure something that person would make many friends :wink:

Due to lack of time andI can’t help with writing but I can help with publishing on the pgrouting website.

Daniel

-Steve


pgrouting-dev mailing list
pgrouting-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-dev