Tuesday, 23 February 2016

pgrouting - Split line at points where other lines touch it in PostGIS


I am trying to create an application that will require a network to be rebuilt several times in an iterative process, adding connections as it progresses. Every iteration needs to use the network created in the last iteration to create the next network.


I am using pgrouting to calculate routes along the network during every iteration, and hoping that building a pgrouting topology does not try to node every intersection, because there are several under/overpasses in the data that I would prefer to simply leave as they are.


However I need to node the new connections that are being made to the existing network, so that I can include them when rebuilding the next network iteration. I have been able to draw a line connecting new points to the network, as well as creating a set of multipoints where the line meets the existing network. I want to split the existing network only at these points, but have all segments retain the attributes of the original line.



Essentially, this is the situation:


enter image description here


I want to manually split the pink line at all the pink dots, so that I can rebuild a pgrouting topology, and I want all the subsequent segments to retain the attributes of the pink line itself.


This is the code that I am using. I just keep receiving the original line's geometry, un-split.


SELECT ST_AsEWKT(ST_Split(N, P)) AS geom
FROM (SELECT
starting_network.geom as N,
cut_points_multi.geom as P
FROM starting_network, cut_points_multi) AS foo;


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...