Hello,
I would like to create a graph (street) using the python interface. I have this:
graphlayer = ce.addGraphLayer('streets')
vertices = [100,0,100, 1000,0,100, 1000,0,500, 100,0,500, 100,0,100]
graph = ce.createGraphSegments(graphlayer, vertices)
But the resulting graph is not "closed". I have set the last vertex to be the same as the first, but that did not work.
I would like to also create the "Block" and the "Lots" automatically, as if I were using the GUI.
Thanks,
Robert
Solved! Go to Solution.
It looks like running "cleanupGraph" does the trick. Or is there a better way?
It looks like running "cleanupGraph" does the trick. Or is there a better way?
In this case the "cleanupGraph" step is needed.
graphlayer = ce.addGraphLayer('streets')
vertices = [100,0,100, 1000,0,100, 1000,0,500, 100,0,500, 100,0,100]
graph = ce.createGraphSegments(graphlayer, vertices)
cleanupSettings = CleanupGraphSettings()
cleanupSettings.setIntersectSegments(True)
cleanupSettings.setMergeNodes(True)
cleanupSettings.setMergingDist(10)
cleanupSettings.setSnapNodesToSegments(True)
cleanupSettings.setSnappingDist(10)
cleanupSettings.setResolveConflictShapes(True)
ce.cleanupGraph(graphlayer, cleanupSettings)