PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ST_MinimumClearanceLine()

Datum ST_MinimumClearanceLine ( PG_FUNCTION_ARGS  )

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

3431 {
3432 #if POSTGIS_GEOS_VERSION < 36
3433  lwpgerror("The GEOS version this PostGIS binary "
3434  "was compiled against (%d) doesn't support "
3435  "'ST_MinimumClearanceLine' function (3.6.0+ required)",
3437  PG_RETURN_NULL();
3438 #else /* POSTGIS_GEOS_VERSION >= 36 */
3439  GSERIALIZED* input;
3440  GSERIALIZED* result;
3441  GEOSGeometry* input_geos;
3442  GEOSGeometry* result_geos;
3443  int srid;
3444 
3445  initGEOS(lwpgnotice, lwgeom_geos_error);
3446 
3447  input = PG_GETARG_GSERIALIZED_P(0);
3448  srid = gserialized_get_srid(input);
3449  input_geos = POSTGIS2GEOS(input);
3450  if (!input_geos)
3451  HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
3452 
3453  result_geos = GEOSMinimumClearanceLine(input_geos);
3454  GEOSGeom_destroy(input_geos);
3455  if (!result_geos)
3456  HANDLE_GEOS_ERROR("Error computing minimum clearance");
3457 
3458  GEOSSetSRID(result_geos, srid);
3459  result = GEOS2POSTGIS(result_geos, LW_FALSE);
3460  GEOSGeom_destroy(result_geos);
3461 
3462  PG_FREE_IF_COPY(input, 0);
3463  PG_RETURN_POINTER(result);
3464 #endif
3465 }
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
Definition: g_serialized.c:100
void lwgeom_geos_error(const char *fmt,...)
#define LW_FALSE
Definition: liblwgeom.h:77
#define HANDLE_GEOS_ERROR(label)
GEOSGeometry * POSTGIS2GEOS(GSERIALIZED *pglwgeom)
GSERIALIZED * GEOS2POSTGIS(GEOSGeom geom, char want3d)
#define POSTGIS_GEOS_VERSION
Definition: sqldefines.h:10

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

Here is the call graph for this function: