PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwgeom_concavehull()

LWGEOM* lwgeom_concavehull ( const LWGEOM geom,
double  ratio,
uint32_t  allow_holes 
)

Take a geometry and build the concave hull.

The concave hull is smaller than the convex hull, but still encompasses all the points of the input. For polygon input the hull encompasses all the input area. For line input the hull encompasses all the input lines.

Parameters
gthe input geometry
ratioproportion of output vs input
allow_holescan there be holes in the output. large performance penalty.

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

1893 {
1894  LWGEOM* result;
1895  int32_t srid = RESULT_SRID(geom);
1896  uint8_t is3d = FLAGS_GET_Z(geom->flags);
1897  GEOSGeometry *g1, *g3;
1898  int geosGeomType;
1899 
1900  initGEOS(lwnotice, lwgeom_geos_error);
1901 
1902  if (!(g1 = LWGEOM2GEOS(geom, AUTOFIX))) GEOS_FAIL();
1903 
1904  geosGeomType = GEOSGeomTypeId(g1);
1905  if (geosGeomType == GEOS_POLYGON || geosGeomType == GEOS_MULTIPOLYGON) {
1906  int is_tight = LW_FALSE;
1907  g3 = GEOSConcaveHullOfPolygons(g1, ratio, is_tight, allow_holes);
1908  }
1909  else {
1910  g3 = GEOSConcaveHull(g1, ratio, allow_holes);
1911  }
1912 
1913  if (!g3)
1914  GEOS_FREE_AND_FAIL(g1);
1915 
1916  GEOSSetSRID(g3, srid);
1917 
1918  if (!(result = GEOS2LWGEOM(g3, is3d)))
1919  GEOS_FREE_AND_FAIL(g1, g3);
1920 
1921  GEOS_FREE(g1, g3);
1922  return result;
1923 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
#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 LW_FALSE
Definition: liblwgeom.h:94
#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, GEOS2LWGEOM(), GEOS_FAIL, GEOS_FREE, GEOS_FREE_AND_FAIL, LW_FALSE, LWGEOM2GEOS(), lwgeom_geos_error(), lwnotice(), result, and RESULT_SRID.

Referenced by ST_ConcaveHull().

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