3606 #if POSTGIS_GEOS_VERSION < 35 3607 lwpgerror(
"The GEOS version this PostGIS binary " 3608 "was compiled against (%d) doesn't support " 3609 "'ST_Voronoi' function (3.5.0+ required)",
3620 int custom_clip_envelope;
3621 int return_polygons;
3624 if (PG_ARGISNULL(0))
3628 if (PG_ARGISNULL(2))
3630 lwpgerror(
"Tolerance must be a positive number.");
3634 tolerance = PG_GETARG_FLOAT8(2);
3638 lwpgerror(
"Tolerance must be a positive number.");
3643 if (PG_ARGISNULL(3))
3645 lwpgerror(
"return_polygons must be true or false.");
3648 return_polygons = PG_GETARG_BOOL(3);
3651 custom_clip_envelope = !PG_ARGISNULL(1);
3652 if (custom_clip_envelope) {
3653 clip = PG_GETARG_GSERIALIZED_P(1);
3656 lwpgerror(
"Could not determine envelope of clipping geometry.");
3657 PG_FREE_IF_COPY(clip, 1);
3660 PG_FREE_IF_COPY(clip, 1);
3664 input = PG_GETARG_GSERIALIZED_P(0);
3670 lwpgerror(
"Could not read input geometry.");
3671 PG_FREE_IF_COPY(input, 0);
3675 lwgeom_result =
lwgeom_voronoi_diagram(lwgeom_input, custom_clip_envelope ? &clip_envelope : NULL, tolerance, !return_polygons);
3680 lwpgerror(
"Error computing Voronoi diagram.");
3681 PG_FREE_IF_COPY(input, 0);
3688 PG_FREE_IF_COPY(input, 0);
3689 PG_RETURN_POINTER(result);
int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *box)
Read the bounding box off a serialization and calculate one if it is not already there.
#define POSTGIS_GEOS_VERSION
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwgeom_voronoi_diagram(const LWGEOM *g, const GBOX *env, double tolerance, int output_edges)
Take vertices of a geometry and build the Voronoi diagram.
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)