PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ 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 2185 of file liblwgeom/lwgeom_geos.c.

2186 {
2187  LWGEOM* result;
2188  int32_t srid = RESULT_SRID(geom);
2189  uint8_t is3d = FLAGS_GET_Z(geom->flags);
2190  GEOSGeometry *g1, *g3;
2191 
2192  initGEOS(lwnotice, lwgeom_geos_error);
2193 
2194  if (!(g1 = LWGEOM2GEOS(geom, AUTOFIX))) GEOS_FAIL();
2195 
2196  g3 = GEOSPolygonHullSimplify(g1, is_outer, vertex_fraction);
2197 
2198  if (!g3)
2199  GEOS_FREE_AND_FAIL(g1);
2200 
2201  GEOSSetSRID(g3, srid);
2202 
2203  if (!(result = GEOS2LWGEOM(g3, is3d)))
2204  GEOS_FREE_AND_FAIL(g1, g3);
2205 
2206  GEOS_FREE(g1, g3);
2207  return result;
2208 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:262
#define GEOS_FREE(...)
#define AUTOFIX
#define RESULT_SRID(...)
#define GEOS_FAIL()
#define GEOS_FREE_AND_FAIL(...)
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, uint8_t want3d)
void lwgeom_geos_error(const char *fmt,...)
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:165
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
lwflags_t flags
Definition: liblwgeom.h:461

References AUTOFIX, LWGEOM::flags, FLAGS_GET_Z, GEOS2LWGEOM(), 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: