PostGIS  2.5.0dev-r@@SVN_REVISION@@
Datum ST_Snap ( PG_FUNCTION_ARGS  )

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

References geometry_serialize(), lwgeom_free(), lwgeom_from_gserialized(), and lwgeom_snap().

3436 {
3437  GSERIALIZED *geom1, *geom2, *result;
3438  LWGEOM *lwgeom1, *lwgeom2, *lwresult;
3439  double tolerance;
3440 
3441  geom1 = PG_GETARG_GSERIALIZED_P(0);
3442  geom2 = PG_GETARG_GSERIALIZED_P(1);
3443  tolerance = PG_GETARG_FLOAT8(2);
3444 
3445  lwgeom1 = lwgeom_from_gserialized(geom1);
3446  lwgeom2 = lwgeom_from_gserialized(geom2);
3447 
3448  lwresult = lwgeom_snap(lwgeom1, lwgeom2, tolerance);
3449  lwgeom_free(lwgeom1);
3450  lwgeom_free(lwgeom2);
3451  PG_FREE_IF_COPY(geom1, 0);
3452  PG_FREE_IF_COPY(geom2, 1);
3453 
3454  result = geometry_serialize(lwresult);
3455  lwgeom_free(lwresult);
3456 
3457  PG_RETURN_POINTER(result);
3458 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1137
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: