Efficient GeoJSON Polygon Splitting
Summary of my bookmarked Github repositories from Dec 9th, 2022
Github repositories
- rowanwins/polygon-splitter
"polygon-splitter" is a lightweight JavaScript library (<10kb minified) that enables the splitting of GeoJSON polygons by a polyline. It supports various types of polygons, including concave polygons, polygons with holes, and single/multi-part geometries. The library can be installed via npm. The API accepts either a GeoJSON feature or geometry, including multipolygons and multilinestrings. The algorithm efficiently splits polygons by keeping track of intersection points and constructing output polygons based on stretches from the polyline and polygon. The performance of the library is significantly better than alternative approaches, as demonstrated by benchmark results. The implementation is based on a custom algorithm, and further details can be found in the source code. The library acknowledges the robust-predicates library by mourner and the support provided by FrontierSI.