PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ ST_MinimumClearanceLine()

Datum ST_MinimumClearanceLine ( PG_FUNCTION_ARGS  )

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

3442{
3443 GSERIALIZED* input;
3444 GSERIALIZED* result;
3445 GEOSGeometry* input_geos;
3446 GEOSGeometry* result_geos;
3447 int32_t srid;
3448
3449 initGEOS(lwpgnotice, lwgeom_geos_error);
3450
3451 input = PG_GETARG_GSERIALIZED_P(0);
3452 srid = gserialized_get_srid(input);
3453 input_geos = POSTGIS2GEOS(input);
3454 if (!input_geos)
3455 HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
3456
3457 result_geos = GEOSMinimumClearanceLine(input_geos);
3458 GEOSGeom_destroy(input_geos);
3459 if (!result_geos)
3460 HANDLE_GEOS_ERROR("Error computing minimum clearance");
3461
3462 GEOSSetSRID(result_geos, srid);
3463 result = GEOS2POSTGIS(result_geos, LW_FALSE);
3464 GEOSGeom_destroy(result_geos);
3465
3466 PG_FREE_IF_COPY(input, 0);
3467 PG_RETURN_POINTER(result);
3468}
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)...
void lwgeom_geos_error(const char *fmt,...)
#define LW_FALSE
Definition liblwgeom.h:108
GSERIALIZED * GEOS2POSTGIS(GEOSGeom geom, char want3d)
#define HANDLE_GEOS_ERROR(label)
GEOSGeometry * POSTGIS2GEOS(GSERIALIZED *pglwgeom)

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

Here is the call graph for this function: