Package io.jmix.maps.utils
Class GeometryUtils
java.lang.Object
io.jmix.maps.utils.GeometryUtils
Utility class containing methods connected with JTS library.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.locationtech.jts.geom.LineString
createLineString
(org.locationtech.jts.geom.Coordinate[] coordinates) Creates aLineString
using the given coordinates.static org.locationtech.jts.geom.MultiLineString
createMultiLineString
(org.locationtech.jts.geom.LineString[] lineStrings) Creates aMultiLineString
using the givenLineString
s.static org.locationtech.jts.geom.MultiPoint
createMultiPoint
(org.locationtech.jts.geom.Point[] points) Creates aMultiPoint
using the givenPoint
s.static org.locationtech.jts.geom.MultiPolygon
createMultiPolygon
(org.locationtech.jts.geom.Polygon[] polygons) Creates aMultiPolygon
using the givenPolygon
s.static org.locationtech.jts.geom.Point
createPoint
(double x, double y) Creates a point with the given coordinates.static org.locationtech.jts.geom.Polygon
createPolygon
(org.locationtech.jts.geom.Coordinate[] shell) Creates aPolygon
with the given exterior boundary.static Double
getAltitude
(org.locationtech.jts.geom.Coordinate c) Returns double value of the altitude of the JTS'sCoordinate
.static org.locationtech.jts.geom.GeometryFactory
Creates aGeometryFactory
having EPSG:4326 spatial-reference ID.static Double
getLatitude
(org.locationtech.jts.geom.Coordinate c) Returns double value of the latitude of the JTS'sCoordinate
.static Double
getLongitude
(org.locationtech.jts.geom.Coordinate c) Returns double value of the longitude of the JTS'sCoordinate
.static org.locationtech.jts.geom.LineString
wktStringToLineString
(String wktString) Converts WKT representation of a polyline to aLineString
object.static org.locationtech.jts.geom.MultiLineString
wktStringToMultiLineString
(String wktString) Converts WKT representation of a multilinestring to aMultiLineString
object.static org.locationtech.jts.geom.MultiPoint
wktStringToMultiPoint
(String wktString) Converts WKT representation of a multipoint to aMultiPoint
object.static org.locationtech.jts.geom.MultiPolygon
wktStringToMultiPolygon
(String wktString) Converts WKT representation of a multipolygon to aMultiPolygon
object.static org.locationtech.jts.geom.Point
wktStringToPoint
(String wktString) Converts WKT representation of a point to aPoint
object.static org.locationtech.jts.geom.Polygon
wktStringToPolygon
(String wktString) Converts WKT representation of a polygon to aPolygon
object.
-
Field Details
-
EPSG_4326
public static final int EPSG_4326- See Also:
-
-
Method Details
-
getLatitude
Returns double value of the latitude of the JTS'sCoordinate
.- Parameters:
c
- JTS'sCoordinate
- Returns:
- Double value of the latitude
-
getLongitude
Returns double value of the longitude of the JTS'sCoordinate
.- Parameters:
c
- JTS'sCoordinate
- Returns:
- Double value of the longitude
-
getAltitude
Returns double value of the altitude of the JTS'sCoordinate
.- Parameters:
c
- JTS'sCoordinate
- Returns:
- Double value of the altitude
-
wktStringToPoint
Converts WKT representation of a point to aPoint
object.- Parameters:
wktString
- WKT representation of a point- Returns:
- Point object
-
wktStringToLineString
Converts WKT representation of a polyline to aLineString
object.- Parameters:
wktString
- WKT representation of a linestring- Returns:
- LineString object
-
wktStringToPolygon
Converts WKT representation of a polygon to aPolygon
object.- Parameters:
wktString
- WKT representation of a polygon- Returns:
- Polygon object
-
wktStringToMultiPoint
Converts WKT representation of a multipoint to aMultiPoint
object.- Parameters:
wktString
- WKT representation of a multipoint- Returns:
- MultiPoint object
-
wktStringToMultiLineString
public static org.locationtech.jts.geom.MultiLineString wktStringToMultiLineString(String wktString) Converts WKT representation of a multilinestring to aMultiLineString
object.- Parameters:
wktString
- WKT representation of a multi polyline- Returns:
- MultiLineString object
-
wktStringToMultiPolygon
Converts WKT representation of a multipolygon to aMultiPolygon
object.- Parameters:
wktString
- WKT representation of a multi polygon- Returns:
- MultiPolygon object
-
getGeometryFactory
public static org.locationtech.jts.geom.GeometryFactory getGeometryFactory()Creates aGeometryFactory
having EPSG:4326 spatial-reference ID.- Returns:
- GeometryFactory
-
createPoint
public static org.locationtech.jts.geom.Point createPoint(double x, double y) Creates a point with the given coordinates.Delegates creating
Point
toGeometryFactory
initialized with EPSG:4326.- Parameters:
x
- the x-valuey
- the y-value- Returns:
- Point object
-
createLineString
public static org.locationtech.jts.geom.LineString createLineString(org.locationtech.jts.geom.Coordinate[] coordinates) Creates aLineString
using the given coordinates.Delegates creating
LineString
toGeometryFactory
initialized with EPSG:4326.- Parameters:
coordinates
- an array without null elements- Returns:
- linestring object
-
createPolygon
public static org.locationtech.jts.geom.Polygon createPolygon(org.locationtech.jts.geom.Coordinate[] shell) Creates aPolygon
with the given exterior boundary.Delegates creating
Polygon
toGeometryFactory
initialized with EPSG:4326.- Parameters:
shell
- the outer boundary of the new Polygon- Returns:
- a polygon object
-
createMultiPoint
public static org.locationtech.jts.geom.MultiPoint createMultiPoint(org.locationtech.jts.geom.Point[] points) Creates aMultiPoint
using the givenPoint
s.Delegates creating
MultiPoint
toGeometryFactory
initialized with EPSG:4326.- Parameters:
points
- an array of Points (without null elements)- Returns:
- a multipoint
-
createMultiLineString
public static org.locationtech.jts.geom.MultiLineString createMultiLineString(org.locationtech.jts.geom.LineString[] lineStrings) Creates aMultiLineString
using the givenLineString
s.Delegates creating
MultiLineString
toGeometryFactory
initialized with EPSG:4326.- Parameters:
lineStrings
- array of linestrings- Returns:
- a multilinestring
-
createMultiPolygon
public static org.locationtech.jts.geom.MultiPolygon createMultiPolygon(org.locationtech.jts.geom.Polygon[] polygons) Creates aMultiPolygon
using the givenPolygon
s.Delegates creating
MultiPolygon
toGeometryFactory
initialized with EPSG:4326.- Parameters:
polygons
- array of polygons- Returns:
- a multipolygon
-