410 in_geom = PG_GETARG_GSERIALIZED_P(0);
415 PG_RETURN_POINTER(in_geom);
418 in_point = PG_GETARG_GSERIALIZED_P(1);
420 if ( in_lwpoint == NULL )
422 lwpgerror(
"Offset geometry must be a point");
425 grid.
xsize = PG_GETARG_FLOAT8(2);
426 grid.
ysize = PG_GETARG_FLOAT8(3);
427 grid.
zsize = PG_GETARG_FLOAT8(4);
428 grid.
msize = PG_GETARG_FLOAT8(5);
432 grid.
ipx = offsetpoint.
x;
433 grid.
ipy = offsetpoint.
y;
437 #if POSTGIS_DEBUG_LEVEL >= 4
444 PG_RETURN_POINTER(in_geom);
449 POSTGIS_DEBUGF(3,
"SnapToGrid got a %s",
lwtype_name(in_lwgeom->
type));
452 if ( out_lwgeom == NULL ) PG_RETURN_NULL();
460 POSTGIS_DEBUGF(3,
"SnapToGrid made a %s",
lwtype_name(out_lwgeom->
type));
464 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.
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.
LWGEOM * lwgeom_grid(const LWGEOM *lwgeom, const gridspec *grid)
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)