Package org.h2gis.utilities.jts_utils
Class GeometryFeatureUtils
- java.lang.Object
-
- org.h2gis.utilities.jts_utils.GeometryFeatureUtils
-
public class GeometryFeatureUtils extends Object
An utility class to convert a query in a JSON list- Author:
- Erwan Bocher, CNRS 2023
-
-
Constructor Summary
Constructors Constructor Description GeometryFeatureUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LinkedHashMapgetProperties(ResultSet resultSet, Collection<String> columns)Convert the resulSet values to JSON liststatic ArrayListtoGeojsonCoordinate(org.locationtech.jts.geom.Coordinate coord, int maxdecimaldigits)static ArrayListtoGeojsonCoordinates(org.locationtech.jts.geom.Coordinate[] coords, int maxdecimaldigits)static LinkedHashMaptoGeojsonGeometryCollection(org.locationtech.jts.geom.GeometryCollection geometryCollection, int maxdecimaldigits)static LinkedHashMaptoGeojsonLineString(org.locationtech.jts.geom.LineString lineString, int maxdecimaldigits)static LinkedHashMaptoGeojsonMultiLineString(org.locationtech.jts.geom.MultiLineString multiLineString, int maxdecimaldigits)static LinkedHashMaptoGeojsonMultiPoint(org.locationtech.jts.geom.MultiPoint multiPoint, int maxdecimaldigits)static LinkedHashMaptoGeojsonMultiPolygon(org.locationtech.jts.geom.MultiPolygon multiPolygon, int maxdecimaldigits)static LinkedHashMaptoGeojsonPolygon(org.locationtech.jts.geom.Polygon polygon, int maxdecimaldigits)static ArrayListtoList(Connection connection, String query)static ArrayList<LinkedHashMap>toList(Connection connection, String query, int maxdecimaldigits)static ArrayList<LinkedHashMap>toList(ResultSet resultSet, int maxdecimaldigits)Convert a ResulSet to a JSON liststatic LinkedHashMaptoMap(org.locationtech.jts.geom.Geometry geom)Convert a Geometry to a JSON mapstatic LinkedHashMaptoMap(org.locationtech.jts.geom.Geometry geom, int maxdecimaldigits)Convert a Geometry to a JSON mapstatic LinkedHashMaptoPoint(org.locationtech.jts.geom.Point point, int maxdecimaldigits)
-
-
-
Method Detail
-
toList
public static ArrayList toList(Connection connection, String query) throws SQLException
- Parameters:
connection- to the databasequery- the select query to execute- Returns:
- a JSON list
- Throws:
SQLException
-
toList
public static ArrayList<LinkedHashMap> toList(Connection connection, String query, int maxdecimaldigits) throws SQLException
- Parameters:
connection- to the databasequery- the select query to executemaxdecimaldigits- 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 resulsetmaxdecimaldigits- argument may be used to reduce the maximum number of decimal places- Returns:
- a JSON list
- Throws:
Exception
-
getProperties
public static LinkedHashMap getProperties(ResultSet resultSet, Collection<String> columns) throws Exception
Convert the resulSet values to JSON list- Parameters:
resultSet- valuescolumns- column names- Returns:
- 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 geometrymaxdecimaldigits- 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)
-
-