PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwgeom_simplify_polygonal()

LWGEOM * lwgeom_simplify_polygonal ( const LWGEOM geom,
double  vertex_fraction,
uint32_t  is_outer 
)

Computes a boundary-respecting hull of a polygonal geometry, with hull shape determined by a target parameter specifying the fraction of the input vertices retained in the result.

Larger values produce less concave results.

Parameters
geomthe input geometry
vertex_fractionproportion of vertices in output vs input.
is_outerexpand geometry while removing edges.

Definition at line 1926 of file liblwgeom/lwgeom_geos.c.

1927{
1928 LWGEOM* result;
1929 int32_t srid = RESULT_SRID(geom);
1930 uint8_t is3d = FLAGS_GET_Z(geom->flags);
1931 GEOSGeometry *g1, *g3;
1932
1933 initGEOS(lwnotice, lwgeom_geos_error);
1934
1935 if (!(g1 = LWGEOM2GEOS(geom, AUTOFIX))) GEOS_FAIL();
1936
1937 g3 = GEOSPolygonHullSimplify(g1, is_outer, vertex_fraction);
1938
1939 if (!g3)
1941
1942 GEOSSetSRID(g3, srid);
1943
1944 if (!(result = GEOS2LWGEOM(g3, is3d)))
1945 GEOS_FREE_AND_FAIL(g1, g3);
1946
1947 GEOS_FREE(g1, g3);
1948 return result;
1949}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
#define GEOS_FREE(...)
#define AUTOFIX
#define RESULT_SRID(...)
#define GEOS_FAIL()
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
#define GEOS_FREE_AND_FAIL(...)
void lwgeom_geos_error(const char *fmt,...)
void(*) LWGEOM GEOS2LWGEOM)(const GEOSGeometry *geom, uint8_t want3d)
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
void lwnotice(const char *fmt,...) __attribute__((format(printf
Write a notice out to the notice handler.
lwflags_t flags
Definition liblwgeom.h:461

References AUTOFIX, LWGEOM::flags, FLAGS_GET_Z, GEOS_FAIL, GEOS_FREE, GEOS_FREE_AND_FAIL, LWGEOM2GEOS(), lwgeom_geos_error(), lwnotice(), result, and RESULT_SRID.

Referenced by ST_SimplifyPolygonHull().

Here is the call graph for this function:
Here is the caller graph for this function: