Class GeometryFeatureUtils


  • public class GeometryFeatureUtils
    extends Object
    An utility class to convert a query in a JSON list
    Author:
    Erwan Bocher, CNRS 2023
    • Constructor Detail

      • GeometryFeatureUtils

        public GeometryFeatureUtils()
    • Method Detail

      • toList

        public static ArrayList<LinkedHashMap> toList​(Connection connection,
                                                      String query,
                                                      int maxdecimaldigits)
                                               throws SQLException
        Parameters:
        connection - to the database
        query - the select query to execute
        maxdecimaldigits - argument may be used to reduce the maximum number of decimal places
        Returns:
        a JSON list
        Throws:
        SQLException
      • toList

        public static ArrayList<LinkedHashMap> toList​(ResultSet resultSet,
                                                      int maxdecimaldigits)
                                               throws Exception
        Convert a ResulSet to a JSON list
        Parameters:
        resultSet - the resulset
        maxdecimaldigits - argument may be used to reduce the maximum number of decimal places
        Returns:
        a JSON list
        Throws:
        Exception
      • toMap

        public static LinkedHashMap toMap​(org.locationtech.jts.geom.Geometry geom)
        Convert a Geometry to a JSON map
        Parameters:
        geom - the geometry
        Returns:
      • toMap

        public static LinkedHashMap toMap​(org.locationtech.jts.geom.Geometry geom,
                                          int maxdecimaldigits)
        Convert a Geometry to a JSON map
        Parameters:
        geom - the geometry
        maxdecimaldigits - argument may be used to reduce the maximum number of decimal places
        Returns:
        a map
      • toPoint

        public static LinkedHashMap toPoint​(org.locationtech.jts.geom.Point point,
                                            int maxdecimaldigits)
      • toGeojsonLineString

        public static LinkedHashMap toGeojsonLineString​(org.locationtech.jts.geom.LineString lineString,
                                                        int maxdecimaldigits)
      • toGeojsonPolygon

        public static LinkedHashMap toGeojsonPolygon​(org.locationtech.jts.geom.Polygon polygon,
                                                     int maxdecimaldigits)
      • toGeojsonMultiPoint

        public static LinkedHashMap toGeojsonMultiPoint​(org.locationtech.jts.geom.MultiPoint multiPoint,
                                                        int maxdecimaldigits)
      • toGeojsonMultiLineString

        public static LinkedHashMap toGeojsonMultiLineString​(org.locationtech.jts.geom.MultiLineString multiLineString,
                                                             int maxdecimaldigits)
      • toGeojsonMultiPolygon

        public static LinkedHashMap toGeojsonMultiPolygon​(org.locationtech.jts.geom.MultiPolygon multiPolygon,
                                                          int maxdecimaldigits)
      • toGeojsonGeometryCollection

        public static LinkedHashMap toGeojsonGeometryCollection​(org.locationtech.jts.geom.GeometryCollection geometryCollection,
                                                                int maxdecimaldigits)
      • toGeojsonCoordinates

        public static ArrayList toGeojsonCoordinates​(org.locationtech.jts.geom.Coordinate[] coords,
                                                     int maxdecimaldigits)
      • toGeojsonCoordinate

        public static ArrayList toGeojsonCoordinate​(org.locationtech.jts.geom.Coordinate coord,
                                                    int maxdecimaldigits)