I have two line layers (roads and contours in this example) and I would like to split the roads layer every time it crosses/intersects a feature on the contour layer. I can't seem to find a tool that does this, as the intersect tool is expecting a polygon for at least one of the layers. It also appears that GRASS' v.clean only works on a single layer. It seems like a simple task, but I'm at a loss!
EDIT (per comments below): Trying to get this to work in PostGIS now, and having some very strange results. If I do a subset of my dataset (one road, one contour that crosses it), and use the following SQL, I get the expected result, with the road split where the contour crosses it:
insert into "road_split"
select
(ST_Dump(st_split(r.geom,c.geom))).geom
from "road" r, "contour" c
However, if I do the exact same thing with the complete dataset, no roads are split. What am I doing wrong here?
I should note that all features in both the road and contour table are LINESTRINGS.
Answer
I would do the job with OpenJUMP and the Noder tool.
Open your line layers into OpenJUMP
Combine the layers for further processing
This tool will transform all the attributes from the source layers and add a new attribute "LAYER". That will be useful later.
Next use the Noder tool from the menu "Tools - Edit Geometry - Noder.."
Lines will be noded and split. A few split roads selected as a proof.
Finally you can extract the contours and roads back to their own layers by utilizing the LAYER attribute. OpenJUMP has an "Extract Layer by Attribute" tool in the Edit menu for this purpose.
No comments:
Post a Comment