Tag Info

11

I've added a script and some explanation about it. You need polygon boundary for testing if voronoi line intersects boundary. You need densified geometry. Because if polygon boundary has a long segment, skeleton will not be as desired (see the image). Densified geometry is just for generating voronoi lines. I used 10 meter. Depending on your data, you may ...

6

Maybe you can modify pySkeleton by Olivier Teboul to suit your needs. I haven't had the chance to look at the actual code but from what he says it should be pure Python.

6

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 ...

4

One, somewhat round-about option might be to use SAGA's grid skeletonization module (http://www.saga-gis.org/saga_module_doc/2.1.3/imagery_segmentation_1.html), either through QGIS or using the command line saga_cmd utility. You'd have to convert your polygon to a SAGA raster first. Otherwise, as stated by @Alpha-beta-soup, you could use v.skeleton from ...

4

In PostGIS 2.2 with SFCGAL, this can be done with ST_StraightSkeleton or ST_ApproximateMedialAxis, depending on your criteria.

3

Take the result of the Skeletonize method and remove the short line segments. Since the output is a single feature, first split the segments into separate features. The tool Multipart to single parts should achieve this. If not, you may need to resort to Explode lines, which will split the line apart at the vertices. Select the short lines with the Select ...

3

You can use pySkeleton as follows: from pySkeleton import polygon vertices = [(0,0), (0,5), (5,5), (5,0)] edges = [(0,1), (1,2), (2,3), (3,0)] p = polygon.Polygon(vertices, edges) skeleton_graph = p.straight_skeleton() You get a Graph-Object with Nodes and Arcs, which you can access simply by: nodes = skeleton_graph.nodes arcs = skeleton_graph.arcs As ...

2

Non-Convex Polygon You should draw the Medial Axis Transform (skeleton or center-line) of the polygon. Options to do this: Create Centerlines use CGAL with arcobjects Then utilize the centerlines calculate network based distanced between any two points and find the farthest ones. Convex Polygon The simplest, albeit not the most efficient way is to ...

1

I assume you are referring to the GRASS module v.voronoi, with the -s option to create a voronoi diagram around polygons. There is an open issue with this module. I suggest that you first create centroids, and then try to run v.voronoi around those centroid points.

1

Try this in QGIS Python Console: from HCMGIS.hcmgis_library import * #Create Medial Axis/ Skeleton from Road in Polygon input = "D:\\osm\\road.shp" output = "D:\\osm\\skeleton.shp" hcmgis_medialaxis(input, 'OBJECTID', 1,output,status_callback = None) #hcmgis_medialaxis(layer, field, density,output,status_callback = None): #field: unique field of ...

1

The GRASS module v.clean has a tool "rmdangle" to remove short lines that go nowhere. Might help in the first part of your question. This module works on the vectorized layer; you pass it a threshold value to set what the maximum size of a dangle should be.

1

A russian mapper has made a tool for road network generalization, but it has three drawbacks: It's in Visual Basic. It reads and produces .mp files made with osm2mp. Documentation is in Russian. Sadly, @Mapper is right: there is no such general-purpose solution not only for OpenStreetMap data, but in general, for any open geodata format.

Only top voted, non community-wiki answers of a minimum length are eligible