Package: numgeo
Numgeo, a geospatial packageNote: This file is best viewed with support for the Markdown markup language.Numgeo is a package of Python modules that, at present, primarily supportsskeletonization.In simple terms, the skeleton of a polygon collapses an elongate polygon to a linear form. For example, the  outline of a river is a polygon (with a nonzero area). However, we often think of a river in terms of its skeleton, such as when a river is drawn as one or more squiggly lines on a map. Even though those lines do not represent the river's width, they still capture a useful expression of the river's geometry.The Algorithm, in briefThe algorithm builds on a long history of work by others. It also has a lot of moving parts, but these are the highlights:Sample points along the boundary of an input polygon, including around any holes.Compute a Voronoi diagram. (https://en.wikipedia.org/wiki/Voronoi_diagram)Isolate the "graph skeleton" from the other extraneous bits  in the Voronoi diagram (which together make up the graph skeleton's "complement"). For example, each hole in polygon has its own skeleton that should be discarded."Partition out" paths from the graph skeleton to incrementally construct the "partitioned skeleton".This is a bit like moving Lego blocks (segments) from one toy box (skeleton) to another, stacking some of them together during the transfer (to form continuous paths of many segments).Optionally add "tails" to the paths so that they extend to polygon's boundary rather than stopping short.Optionally prune away undesired paths to simplify the skeleton and remove noise.This is accomplished using the normalized length metric.Quick startIf you're keen to get started, consider the following code (but don't run it just yet!):fromnumgeo.scripts.skelimportprocessprocess(r"path/to/polygon_shapefile.shp",interval=0.1,min_normalized_length=0.)interval, in effect, specifies the desired resolution of the output skeleton, in map units (e.g., meters). If the narrowest constriction in your input polygons isxmap units, you should specifyinterval<0.5x.min_normalized_length, in effect, specifies how simple you want the output skeleton to be, with higher values corresponding to greater simplicity.  Any value less than 1. results in no simplification, so the "raw" skeleton itself is output, which may have a lot of unwanted bits.Therefore, if you were to run the example code, you'd derive a "raw" skeleton at a resolution of 0.1 m (if your map unit is one meter). Because you did not specify an output path, the skeleton would default topath/to/polygon_shapefile_skel.shp.Quick tips:It ishighlyrecommended that you read the documentation on Installation before installing numgeo.Processing time and memory use both increase exponentially with progressively smallerintervalvalues, so be careful when choosing a value.You might consider callingprocess(...)a few times, each time with differentintervalandmin_normalized_lengthvalues, to build an intuition for how these arguments affect the output skeleton.In that case, you can specifyout_path_prefixto avoid overwriting previous outputs. For example,out_path_prefix="A_"would output topath/to/A_polygon_shapefile_skel.shp.