Bug report #2561

splitGeometry returns one part of the splitted line, instead of two

Added by Maxim Dubinin almost 15 years ago. Updated almost 15 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Vectors
Affected QGIS version: Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied: Resolution:wontfix
Crashes QGIS or corrupts data: Copied to github as #:12621

Description

Easy to try on two intersecting lines (two nodes each)

Sample code for python console (two lines are selected):

cl = qgis.utils.iface.mapCanvas().currentLayer()
selfeats = cl.selectedFeatures()
geom0 = [[QgsGeometry]](selfeatsr0.geometry())
geom1 = [[QgsGeometry]](selfeatsr1.geometry())
(res, newlist, topolist) = geom1.splitGeometry(pnts, False)

Resulting newlist contains only 1 object, one part of the line, should have 2.

History

#1 Updated by Maxim Dubinin almost 15 years ago

Overedited the code, sorry

cl = qgis.utils.iface.mapCanvas().currentLayer()
selfeats = cl.selectedFeatures()
geom0 = [[QgsGeometry]](selfeatsr0.geometry())
geom1 = [[QgsGeometry]](selfeatsr1.geometry())
pnt0=geom0.vertexAt(0)
pnt1=geom0.vertexAt(1)
pnts=[]
pnts.append(pnt0)
pnts.append(pnt1)
(res, newlist, topolist) = geom1.splitGeometry(pnts, False)

#2 Updated by Marco Hugentobler almost 15 years ago

  • Resolution set to wontfix
  • Status changed from Open to Closed

This is intended behaviour. The line is splitted into two parts. Part one is
still geom1 (but changed). The second (new) geometry is in newlist.

Also available in: Atom PDF