Class 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
    • 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 - Geometry
        cell_size - snapping grid tolerance
        Returns:
        Geometry
        Throws:
        SQLException
      • scaleFactorForDecimalPlaces

        public static double scaleFactorForDecimalPlaces​(int decimalPlaces)
        Computes the scale factor for a given number of decimal places.
        Parameters:
        decimalPlaces - number of decimals
        Returns:
        the scale factor