From 8b400807e492fc5bcd429b151809480ed7a9f304 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 6 Jan 2005 15:29:03 +0000 Subject: [PATCH] Renamed Apply_Grid to SnapToGrid, documented behaviour of collapsed geoms. git-svn-id: http://svn.osgeo.org/postgis/trunk@1235 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/postgis.xml | 17 +++++++++++------ lwgeom/lwgeom_functions_analytic.c | 12 ++++++------ lwgeom/lwpostgis.sql.in | 12 ++++++------ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/doc/postgis.xml b/doc/postgis.xml index 5e9fcbf14..bb8115b5c 100644 --- a/doc/postgis.xml +++ b/doc/postgis.xml @@ -4057,14 +4057,19 @@ FROM geometry_table; - Apply_Grid(geometry, originX, originY, sizeX, sizeY) - Apply_Grid(geometry, sizeX, sizeY) - Apply_Grid(geometry, size) + SnapToGrid(geometry, originX, originY, sizeX, sizeY) + SnapToGrid(geometry, sizeX, sizeY) + SnapToGrid(geometry, size) - 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. + 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. + diff --git a/lwgeom/lwgeom_functions_analytic.c b/lwgeom/lwgeom_functions_analytic.c index 567361fad..048087276 100644 --- a/lwgeom/lwgeom_functions_analytic.c +++ b/lwgeom/lwgeom_functions_analytic.c @@ -464,7 +464,7 @@ Datum LWGEOM_line_interpolate_point(PG_FUNCTION_ARGS) * * Run like this: * - * SELECT apply_grid(, , , , ); + * SELECT SnapToGrid(, , , , ); * * Grid cells are not visible on a screen as long as the screen * point size is equal or bigger then the grid cell size. @@ -501,7 +501,7 @@ LWPOINT * lwpoint_grid(LWPOINT *point, gridspec *grid); 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. @@ -786,8 +786,8 @@ lwgeom_grid(LWGEOM *lwgeom, gridspec *grid) } } -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; @@ -819,7 +819,7 @@ Datum LWGEOM_apply_grid(PG_FUNCTION_ARGS) 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); @@ -841,7 +841,7 @@ Datum LWGEOM_apply_grid(PG_FUNCTION_ARGS) } #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); diff --git a/lwgeom/lwpostgis.sql.in b/lwgeom/lwpostgis.sql.in index 2ea7579c1..42e9bb06a 100644 --- a/lwgeom/lwpostgis.sql.in +++ b/lwgeom/lwpostgis.sql.in @@ -3166,19 +3166,19 @@ CREATEFUNCTION simplify(geometry, float8) 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) -- 2.40.0