</varlistentry>
<varlistentry>
- <term>Apply_Grid(geometry, originX, originY, sizeX, sizeY)</term>
- <term>Apply_Grid(geometry, sizeX, sizeY)</term>
- <term>Apply_Grid(geometry, size)</term>
+ <term>SnapToGrid(geometry, originX, originY, sizeX, sizeY)</term>
+ <term>SnapToGrid(geometry, sizeX, sizeY)</term>
+ <term>SnapToGrid(geometry, size)</term>
<listitem>
- <para>Apply the grid defined by its origin and cell size to
- the geometry points so that each one falls on a cell.
- Remove consecutive points falling on the same cell.</para>
+ <para>Snap all points of the input geometry to the grid
+ defined by its origin and cell size.
+ Remove consecutive points falling on the same cell,
+ eventually returning NULL if output points are not
+ enough to define a geometry of the given type.
+ Collapsed geometries in a collection are stripped
+ from it.
+ </para>
</listitem>
</varlistentry>
*
* Run like this:
*
- * SELECT apply_grid(<geometry>, <originX>, <originY>, <sizeX>, <sizeY>);
+ * SELECT SnapToGrid(<geometry>, <originX>, <originY>, <sizeX>, <sizeY>);
*
* Grid cells are not visible on a screen as long as the screen
* point size is equal or bigger then the grid cell size.
LWPOLY * lwpoly_grid(LWPOLY *poly, gridspec *grid);
LWLINE *lwline_grid(LWLINE *line, gridspec *grid);
POINTARRAY *ptarray_grid(POINTARRAY *pa, gridspec *grid);
-Datum LWGEOM_apply_grid(PG_FUNCTION_ARGS);
+Datum LWGEOM_snaptogrid(PG_FUNCTION_ARGS);
/*
* Stick an array of points to the given gridspec.
}
}
-PG_FUNCTION_INFO_V1(LWGEOM_apply_grid);
-Datum LWGEOM_apply_grid(PG_FUNCTION_ARGS)
+PG_FUNCTION_INFO_V1(LWGEOM_snaptogrid);
+Datum LWGEOM_snaptogrid(PG_FUNCTION_ARGS)
{
Datum datum;
PG_LWGEOM *in_geom;
in_lwgeom = lwgeom_deserialize(SERIALIZED_FORM(in_geom));
#if VERBOSE
- elog(NOTICE, "apply_grid got a %s", lwgeom_typename(TYPE_GETTYPE(in_lwgeom->type)));
+ elog(NOTICE, "SnapToGrid got a %s", lwgeom_typename(TYPE_GETTYPE(in_lwgeom->type)));
#endif
out_lwgeom = lwgeom_grid(in_lwgeom, &grid);
}
#if VERBOSE
- elog(NOTICE, "apply_grid made a %s", lwgeom_typename(TYPE_GETTYPE(out_lwgeom->type)));
+ elog(NOTICE, "SnapToGrid made a %s", lwgeom_typename(TYPE_GETTYPE(out_lwgeom->type)));
#endif
out_geom = pglwgeom_serialize(out_lwgeom);
AS '@MODULE_FILENAME@', 'LWGEOM_simplify2d'
LANGUAGE 'C' WITH (isstrict,iscachable);
-CREATEFUNCTION apply_grid(geometry, float8, float8, float8, float8)
+CREATEFUNCTION SnapToGrid(geometry, float8, float8, float8, float8)
RETURNS geometry
- AS '@MODULE_FILENAME@', 'LWGEOM_apply_grid'
+ AS '@MODULE_FILENAME@', 'LWGEOM_snaptogrid'
LANGUAGE 'C' WITH (isstrict,iscachable);
-CREATEFUNCTION apply_grid(geometry, float8, float8)
+CREATEFUNCTION SnapToGrid(geometry, float8, float8)
RETURNS geometry
- AS 'SELECT apply_grid($1, 0, 0, $2, $3)'
+ AS 'SELECT SnapToGrid($1, 0, 0, $2, $3)'
LANGUAGE 'SQL' WITH (isstrict,iscachable);
-CREATEFUNCTION apply_grid(geometry, float8)
+CREATEFUNCTION SnapToGrid(geometry, float8)
RETURNS geometry
- AS 'SELECT apply_grid($1, 0, 0, $2, $2)'
+ AS 'SELECT SnapToGrid($1, 0, 0, $2, $2)'
LANGUAGE 'SQL' WITH (isstrict,iscachable);
CREATEFUNCTION line_interpolate_point(geometry, float8)