PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ ST_Snap()

Datum ST_Snap ( PG_FUNCTION_ARGS  )

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

References geometry_serialize(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_snap(), PG_FUNCTION_INFO_V1(), POSTGIS_GEOS_VERSION, and ST_Split().

Referenced by ST_DelaunayTriangles().

3662 {
3663 #if POSTGIS_GEOS_VERSION < 33
3664  lwpgerror("The GEOS version this PostGIS binary "
3665  "was compiled against (%d) doesn't support "
3666  "'ST_Snap' function (3.3.0+ required)",
3668  PG_RETURN_NULL();
3669 #else /* POSTGIS_GEOS_VERSION >= 33 */
3670  GSERIALIZED *geom1, *geom2, *result;
3671  LWGEOM *lwgeom1, *lwgeom2, *lwresult;
3672  double tolerance;
3673 
3674  geom1 = PG_GETARG_GSERIALIZED_P(0);
3675  geom2 = PG_GETARG_GSERIALIZED_P(1);
3676  tolerance = PG_GETARG_FLOAT8(2);
3677 
3678  lwgeom1 = lwgeom_from_gserialized(geom1);
3679  lwgeom2 = lwgeom_from_gserialized(geom2);
3680 
3681  lwresult = lwgeom_snap(lwgeom1, lwgeom2, tolerance);
3682  lwgeom_free(lwgeom1);
3683  lwgeom_free(lwgeom2);
3684  PG_FREE_IF_COPY(geom1, 0);
3685  PG_FREE_IF_COPY(geom2, 1);
3686 
3687  result = geometry_serialize(lwresult);
3688  lwgeom_free(lwresult);
3689 
3690  PG_RETURN_POINTER(result);
3691 
3692 #endif /* POSTGIS_GEOS_VERSION >= 33 */
3693 
3694 }
#define POSTGIS_GEOS_VERSION
Definition: sqldefines.h:10
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
LWGEOM * lwgeom_snap(const LWGEOM *geom1, const LWGEOM *geom2, double tolerance)
Snap vertices and segments of a geometry to another using a given tolerance.
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function:
Here is the caller graph for this function: