400{
407
409
410 in_geom = PG_GETARG_GSERIALIZED_P(0);
411
412
414 {
415 PG_RETURN_POINTER(in_geom);
416 }
417
418 in_point = PG_GETARG_GSERIALIZED_P(1);
420 if ( in_lwpoint == NULL )
421 {
422 lwpgerror("Offset geometry must be a point");
423 }
424
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);
429
430
432 grid.
ipx = offsetpoint.
x;
433 grid.
ipy = offsetpoint.
y;
436
437#if POSTGIS_DEBUG_LEVEL >= 4
438 grid_print(&grid);
439#endif
440
441
443 {
444 PG_RETURN_POINTER(in_geom);
445 }
446
448
449 POSTGIS_DEBUGF(3,
"SnapToGrid got a %s",
lwtype_name(in_lwgeom->
type));
450
452 if ( out_lwgeom == NULL ) PG_RETURN_NULL();
453
454
456 {
458 }
459
460 POSTGIS_DEBUGF(3,
"SnapToGrid made a %s",
lwtype_name(out_lwgeom->
type));
461
463
464 PG_RETURN_POINTER(out_geom);
465}
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.
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
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.
LWGEOM * lwgeom_grid(const LWGEOM *lwgeom, const gridspec *grid)
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)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)