longavailable / voronoi-diagram-for-polygons

A tool to create a Voronoi diagram for polygons
https://longlovemyu.com/voronoi-diagram-for-polygons/
MIT License
45 stars 10 forks source link

Some PostGIS Wrapper? #1

Closed ppKrauss closed 4 years ago

ppKrauss commented 4 years ago

Issue suggestion, to offer a PostGIS wrapper function, like ST_VoronoiPolygons() but accepting the polygons as input.

Voronoi-diagram-for-polygons can be called from Python using the native PL/Python interface of PostgreSQL.

longavailable commented 4 years ago

I don't have experience of using PostGIS/PostgreSQL.

While I noted that PostGIS is performed by GEOS - of course including ST_VoronoiPolygons()- and Shapely is a Python wrapper for GEOS. That means voronoi_diagram from Shapely and ST_VoronoiPolygons from PostGIS have the same engine.

About inputs,

Geopandas further depends on fiona for file access.

Fiona is a wrapper for GDAL/OGR and focus on importing and exporting of GIS data.

Fiona is designed to be simple and dependable. It focuses on reading and writing data in standard Python IO style and relies upon familiar Python types and protocols such as files, dictionaries, mappings, and iterators instead of classes specific to GDAL's OpenGIS Reference Implementation (OGR). Fiona can read and write real-world data using multi-layered GIS formats and zipped virtual file systems and integrates readily with other Python GIS packages such as pyproj, Rtree, and Shapely.

Shortly, you can access data in PostgreSQL by using geopandas.read_postgis() then use voronoiDiagram4plg() function of voronoi-diagram-for-polygons.