Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Returns a copy of the geometry with all points snapped to the specified grid.
The cell size for the grid.
Returns the geometry with all points snapped to the grid.
The spatial reference system identifier of the result is the same as the spatial reference system of the geometry-expression.
The ST_SnapToGrid method can be used to reduce the precision of data by snapping all points in a geometry to a grid defined
by the origin and cell size.
The X and Y coordinates are snapped to the grid; any Z and M values are unchanged.
Reducing precision may cause the resulting geometry to have different properties. For example, it may cause a simple linestring
to cross itself, or it may generate an invalid geometry.
Each spatial reference system defines a grid that all geometries are automatically snapped to. You can not store more precision
than this predefined grid.
By default, ST_SnapToGrid uses the original format for a geometry, if it is available. Otherwise, the internal format is used.
For more information about internal and original formats, see STORAGE FORMAT clause, CREATE SPATIAL REFERENCE SYSTEM statement.
SQL/MM (ISO/IEC 13249-3: 2006)
The following example returns the result LineString (1.536133 6.439453, 2.173828 6.100586).
LineString (1.536133 6.439453, 2.173828 6.100586)
SELECT NEW ST_LineString( 'LineString( 1.5358 6.4391, 2.17401 6.10018 )' )
.ST_SnapToGrid( 0.001 )
Each X and Y coordinate is shifted to the closest grid point using a grid size of approximately 0.001. The actual grid size
used is not exactly the grid size specified.