Package org.h2gis.functions.spatial.generalize

## Class ST_SnapToGrid

- java.lang.Object
- - org.h2gis.api.AbstractFunction
  - - org.h2gis.api.DeterministicScalarFunction
    - - org.h2gis.functions.spatial.generalize.ST_SnapToGrid

All Implemented Interfaces:
  `org.h2gis.api.Function`, `org.h2gis.api.ScalarFunction`

    public class ST_SnapToGrid
    extends org.h2gis.api.DeterministicScalarFunction

Function to snap a geometry according a grid size

Author:
  Erwan Bocher, CNRS, 2024

### Field Summary

### Fields inherited from interface org.h2gis.api.Function

`PROP_NAME, PROP_REMARKS`

### Fields inherited from interface org.h2gis.api.ScalarFunction

`PROP_DETERMINISTIC`

### Constructor Summary

Constructors
`ST_SnapToGrid()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static org.locationtech.jts.geom.Geometry` `execute​(org.locationtech.jts.geom.Geometry geometry, float cell_size)` Reduce the geometry precision.
`String` `getJavaStaticMethod()`
`static double` `scaleFactorForDecimalPlaces​(int decimalPlaces)` Computes the scale factor for a given number of decimal places.

### Methods inherited from class org.h2gis.api.AbstractFunction

`addProperty, getProperty, removeProperty`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.h2gis.api.Function

`getProperty`

### Constructor Detail

#### ST_SnapToGrid

    public ST_SnapToGrid()

### Method Detail

#### getJavaStaticMethod

    public String getJavaStaticMethod()

#### execute

    public static org.locationtech.jts.geom.Geometry execute​(org.locationtech.jts.geom.Geometry geometry,
                                                             float cell_size)
                                                      throws SQLException

Reduce the geometry precision. cell_size is resolution of grid to snap the points

Parameters:
  `geometry` -
  `cell_size` -
Returns:
Throws:
  `SQLException`

#### scaleFactorForDecimalPlaces

    public static double scaleFactorForDecimalPlaces​(int decimalPlaces)

Computes the scale factor for a given number of decimal places.

Parameters:
  `decimalPlaces` -
Returns:
  the scale factor