404 in_geom = PG_GETARG_GSERIALIZED_P(0);
409 PG_RETURN_POINTER(in_geom);
412 in_point = PG_GETARG_GSERIALIZED_P(1);
414 if ( in_lwpoint == NULL )
416 lwpgerror(
"Offset geometry must be a point");
419 grid.
xsize = PG_GETARG_FLOAT8(2);
420 grid.
ysize = PG_GETARG_FLOAT8(3);
421 grid.
zsize = PG_GETARG_FLOAT8(4);
422 grid.
msize = PG_GETARG_FLOAT8(5);
426 grid.
ipx = offsetpoint.
x;
427 grid.
ipy = offsetpoint.
y;
431 #if POSTGIS_DEBUG_LEVEL >= 4
438 PG_RETURN_POINTER(in_geom);
443 POSTGIS_DEBUGF(3,
"SnapToGrid got a %s",
lwtype_name(in_lwgeom->
type));
446 if ( out_lwgeom == NULL ) PG_RETURN_NULL();
454 POSTGIS_DEBUGF(3,
"SnapToGrid made a %s",
lwtype_name(out_lwgeom->
type));
456 out_geom = geometry_serialize(out_lwgeom);
458 PG_RETURN_POINTER(out_geom);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
LWGEOM * lwgeom_grid(const LWGEOM *lwgeom, gridspec *grid)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)