1

I have a postGIS database populated with OSM data with the osm2po import tool. I have a number of fixed points that I want to route between using pgrouting. In order to do this accurately, I want to create new nodes (vertices) at nearest points on nearest edges to the actual coordinates to be used as sources and targets for routing. I also want to replace the original edge with the two edge fragments split from the original and have one of their endpoints be the new node and the other endpoint be the original endpoints of the original edge. Since the points are fixed, creating a fixed number of these new nodes permanently to the database should not be an issue.

What would be the best way to achieve this? It looks like the ST_NewEdgesSplit function [1] might be able to do this but it requires a parameter "varchar atopology", which I assume is a topology schema name. I'm not sure I have one, since I've constucted the databse with osm2po.

  • Well you can use ST_AddPoint to insert a point inside a linestring, without having to install the topology extension, but I am not completely sure I understand what you are trying to do. – John Powell Jan 14 '15 at 12:30
  • I fear that if you split edges of a graph that way you must resolve the routing again for the whole graph. Reading through this set of documents should give some more light docs.pgrouting.org/2.0/en/doc/index.html. – user30184 Jan 14 '15 at 14:08
3

This looks like what you are trying to do -- take a look at it.
The example below uses the old name

http://trac.osgeo.org/postgis/wiki/UsersWikiSplitPolygonWithPoints

Anyrate the key is using ST_LineSubString - http://postgis.net/docs/manual-2.1/ST_LineSubstring.html

Also as noted by user30184 once you do this, the nodes created by osm2po would be no good. Your best bet would be to create a new table from your existing edges using the above approach. And then follow instructions on how to make your edge table routable. Kind of like described in workshop: http://workshop.pgrouting.org/chapters/topology.html#calculate-topology

|improve this answer|||||

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.