PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ ST_MinimumClearanceLine()

Datum ST_MinimumClearanceLine ( PG_FUNCTION_ARGS  )

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

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

Referenced by ST_MinimumClearance().

3434 {
3435 #if POSTGIS_GEOS_VERSION < 36
3436  lwpgerror("The GEOS version this PostGIS binary "
3437  "was compiled against (%d) doesn't support "
3438  "'ST_MinimumClearanceLine' function (3.6.0+ required)",
3440  PG_RETURN_NULL();
3441 #else /* POSTGIS_GEOS_VERSION >= 36 */
3442  GSERIALIZED* input;
3443  GSERIALIZED* result;
3444  GEOSGeometry* input_geos;
3445  GEOSGeometry* result_geos;
3446  int srid;
3447 
3448  initGEOS(lwpgnotice, lwgeom_geos_error);
3449 
3450  input = PG_GETARG_GSERIALIZED_P(0);
3451  srid = gserialized_get_srid(input);
3452  input_geos = POSTGIS2GEOS(input);
3453  if (!input_geos)
3454  HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
3455 
3456  result_geos = GEOSMinimumClearanceLine(input_geos);
3457  GEOSGeom_destroy(input_geos);
3458  if (!result_geos)
3459  HANDLE_GEOS_ERROR("Error computing minimum clearance");
3460 
3461  GEOSSetSRID(result_geos, srid);
3462  result = GEOS2POSTGIS(result_geos, LW_FALSE);
3463  GEOSGeom_destroy(result_geos);
3464 
3465  PG_FREE_IF_COPY(input, 0);
3466  PG_RETURN_POINTER(result);
3467 #endif
3468 }
#define POSTGIS_GEOS_VERSION
Definition: sqldefines.h:10
void lwgeom_geos_error(const char *fmt,...)
#define LW_FALSE
Definition: liblwgeom.h:76
GEOSGeometry * POSTGIS2GEOS(GSERIALIZED *pglwgeom)
GSERIALIZED * GEOS2POSTGIS(GEOSGeom geom, char want3d)
#define HANDLE_GEOS_ERROR(label)
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:99
Here is the call graph for this function:
Here is the caller graph for this function: