I am trying to find a tool to create a skeleton of a large vector dataset using QGIS and its bundle. It should be directly programmatically callable through Python or commandline (QGIS, GRASS, OGR etc. are all okay).
The target is a large thin polygon with holes representing street areas and I need to obtain an approximation of the road network via skeletonization.
What I found so far:
- GRASS 7.0 has
v.skeleton
which should be good enough but does not seem to be in for integration with QGIS in the near future. - CGAL has skeletonize algorithms, of course, but the Python support is very poor.
- pySkeleton does not work for me and I probably don't have time to salvage the code.
Other alternatives (openJump skeletonizer, this old ArcGIS plugin…) cannot be easily plugged into QGIS/Python.
Any other suggestions?
Best Answer
This document "Skeletonizing Polygons Using PostGIS" describes a process which utilises tools from PostGIS and GRASS, both of which might be callable. It mentions using PostGIS to create a skeleton of the vectors and cleaning it up using either PostGIS again or GRASS.
There are existing tools from the Processing Toolbox which hopefully simplifies things when calling from Python/command line such as:
Import into PostGIS - use to import your dataset.
PostGIS execute SQL - use to run the
ST_StraightSkeleton
function.v.clean - use to run the
rmdangle
tool.Hope this helps!