PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ ST_MinimumClearanceLine()

Datum ST_MinimumClearanceLine ( PG_FUNCTION_ARGS  )

Definition at line 3598 of file postgis/lwgeom_geos.c.

3599 {
3600  GSERIALIZED* input;
3602  GEOSGeometry* input_geos;
3603  GEOSGeometry* result_geos;
3604  int32_t srid;
3605 
3606  initGEOS(lwpgnotice, lwgeom_geos_error);
3607 
3608  input = PG_GETARG_GSERIALIZED_P(0);
3609  srid = gserialized_get_srid(input);
3610  input_geos = POSTGIS2GEOS(input);
3611  if (!input_geos)
3612  HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
3613 
3614  result_geos = GEOSMinimumClearanceLine(input_geos);
3615  GEOSGeom_destroy(input_geos);
3616  if (!result_geos)
3617  HANDLE_GEOS_ERROR("Error computing minimum clearance");
3618 
3619  GEOSSetSRID(result_geos, srid);
3620  result = GEOS2POSTGIS(result_geos, LW_FALSE);
3621  GEOSGeom_destroy(result_geos);
3622 
3623  PG_FREE_IF_COPY(input, 0);
3624  PG_RETURN_POINTER(result);
3625 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
Definition: gserialized.c:126
void lwgeom_geos_error(const char *fmt,...)
#define LW_FALSE
Definition: liblwgeom.h:108
#define HANDLE_GEOS_ERROR(label)
GSERIALIZED * GEOS2POSTGIS(GEOSGeom geom, char want3d)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)

References GEOS2POSTGIS(), gserialized_get_srid(), HANDLE_GEOS_ERROR, LW_FALSE, lwgeom_geos_error(), POSTGIS2GEOS(), and result.

Here is the call graph for this function: