2

I have a polyline layer. I want to split this polyline layer at CROSSING POINT. With two steps I want to do this.

  1. I show the user the CROSSING POINT of polyline layer.
  2. With this CROSSING POINT, I want to split the polyline layer.

I am on Arcgis 10 with .NET/arcpy. Second step can be done with SPLIT LINE AT POINT tool. But how can I identify the crossing point?

I have attached image to clear my problem.

enter image description here

2

2 Answers 2

9

I think I know what you mean, you should do that by 2 tools step by step first step find in arctoolbox intersect (Analysis) and then create intersect point layer in Intersection tools window choose "point" in output type field intersect(Analysis)

finally [Step2] by Split line at point tools in ArcToolbox you can split polyline based on intersection points

for example: Config your Intersection Tool window like below picture enter image description here Config your Split Line At Point like below picture enter image description here

3
  • If you're doing this in ArcObjects you want to use an ISpatialFilter to find the intersecting features, combine into a multipart geometry then use ITopologicalOperator.Intersect resources.arcgis.com/en/help/arcobjects-net/componenthelp/… with esriGeometry0Dimension to generate the multipoint where intersections occur between the lines. This question is tagged as 'ArcObjects' but I can't see any code so I'm thinking that tag might be erroneous, in which case I support this answer. Commented Aug 9, 2016 at 1:23
  • @Predator X, thanks for for your quick reply. It was helpful for me. But may be I have faced another problem. I have only one polyline feature in one polyline feature class. And this polyline feature has crossed itself. Then how can I find this crossing point?? INTERSECT tool may not gives self crossing point . Thanks again for your ans.
    – Monir
    Commented Aug 10, 2016 at 11:00
  • @Monir, your welcome, please pay attention to my sample, I used only one polyline feature class no more, it doesn't matter how many lines are in polyline feature class one or more than one, If line has cross even with itself, It's ok you can do it, try again.
    – Navid
    Commented Aug 10, 2016 at 11:13
2

Although there is already an accepted answer to this question, as it was tagged as arcpy, I'd like to add one open source alternative by using one equivalent tool: PyQGIS.

My polyline layer was very similar to above question:

enter image description here

Complete code is:

import itertools

layer = iface.activeLayer()

feats = [ feat for feat in layer.getFeatures() ]

n = len(feats)

list = range(n)

points = [ feats[i].geometry().intersection(feats[j].geometry()).asPoint()
           for i,j in itertools.combinations(list, 2)
           if feats[i].geometry().intersects(feats[j].geometry()) ]

lines = [ [ points[i], points[j] ] 
            for i,j in itertools.combinations(list, 2) ]

epsg = layer.crs().postgisSrid()

uri = "Point?crs=epsg:" + str(epsg) + "&field=id:integer""&index=yes"

mem_layer = QgsVectorLayer(uri,
                           'points',
                           'memory')

prov = mem_layer.dataProvider()

feats = [ QgsFeature() for i in range(len(points)) ]

for i, feat in enumerate(feats):
    feat.setAttributes([i])
    feat.setGeometry(QgsGeometry.fromPoint(points[i]))

prov.addFeatures(feats)

QgsMapLayerRegistry.instance().addMapLayer(mem_layer)

uri = "LineString?crs=epsg:" + str(epsg) + "&field=id:integer""&index=yes"

mem_layer = QgsVectorLayer(uri,
                           'lines',
                           'memory')

prov = mem_layer.dataProvider()

feats = [ QgsFeature() for i in range(len(lines)) ]

for i, feat in enumerate(feats):
    feat.setAttributes([i])
    feat.setGeometry(QgsGeometry.fromPolyline(lines[i]))

prov.addFeatures(feats)

QgsMapLayerRegistry.instance().addMapLayer(mem_layer)

After running it at the Python Console of QGIS, I got crossing points and split polyline layer:

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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