Package org.bremersee.geojson.utils
Class GeometryUtils
- java.lang.Object
-
- org.bremersee.geojson.utils.GeometryUtils
-
public abstract class GeometryUtils extends Object
Utility methods for geometry objects.- Author:
- Christian Bremer
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_SPATIAL_AUTHORITYDefault spatial authority: 'EPSG'.static doubleEARTH_RADIUS_METERSThe earth radius in meters.static StringMERCATOR_CRSCRS (Coordinate reference system) of mercator: 'EPSG:3857'.static StringMERCATOR_CRS_ALTAlternative CRS (Coordinate reference system) of mercator: 'EPSG:900913'.static doubleMERCATOR_MAX_LATMaximum latitude for mercator projection.static doubleMERCATOR_MIN_LATMinimum latitude for mercator projection.static intMERCATOR_SPATIAL_REFERENCE_IDReference ID of mercator projection: '3857'.static intMERCATOR_SPATIAL_REFERENCE_ID_ALTAlternative reference ID of mercator: '900913'.static StringWGS84_CRSCRS (Coordinate reference system) of WGS84: 'EPSG:4326'.static intWGS84_SPATIAL_REFERENCE_IDReference ID of WGS84: '4326'.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.locationtech.jts.geom.GeometrycopyAndApplyFilters(org.locationtech.jts.geom.Geometry geometry, org.locationtech.jts.geom.CoordinateFilter... filters)Copy and apply filters.static org.locationtech.jts.geom.CoordinatecreateCoordinate(double x, double y)Creates a coordinate.static org.locationtech.jts.geom.CoordinatecreateCoordinate(BigDecimal x, BigDecimal y)Creates a coordinate.static org.locationtech.jts.geom.CoordinatecreateCoordinateWGS84(double latitude, double longitude)Creates a coordinate.static org.locationtech.jts.geom.CoordinatecreateCoordinateWGS84(BigDecimal latitude, BigDecimal longitude)Creates a coordinate.static org.locationtech.jts.geom.GeometryCollectioncreateGeometryCollection(Collection<? extends org.locationtech.jts.geom.Geometry> geometries)Create geometry collection geometry collection.static org.locationtech.jts.geom.GeometryCollectioncreateGeometryCollection(Collection<? extends org.locationtech.jts.geom.Geometry> geometries, org.locationtech.jts.geom.GeometryFactory geometryFactory)Create geometry collection geometry collection.static org.locationtech.jts.geom.GeometryCollectioncreateGeometryCollection(org.locationtech.jts.geom.Geometry... geometries)Create geometry collection geometry collection.static org.locationtech.jts.geom.LinearRingcreateLinearRing(Collection<? extends org.locationtech.jts.geom.Coordinate> coordinates)Creates a LinearRing using the given coordinates.static org.locationtech.jts.geom.LinearRingcreateLinearRing(Collection<? extends org.locationtech.jts.geom.Coordinate> coordinates, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a LinearRing using the given coordinates.static org.locationtech.jts.geom.LineStringcreateLineString(Collection<? extends org.locationtech.jts.geom.Coordinate> coordinates)Creates a LineString using the given coordinates; a null or empty collection will create an empty LineString.static org.locationtech.jts.geom.LineStringcreateLineString(Collection<? extends org.locationtech.jts.geom.Coordinate> coordinates, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a LineString using the given coordinates; a null or empty collection will create an empty LineString.static org.locationtech.jts.geom.MultiLineStringcreateMultiLineString(Collection<? extends org.locationtech.jts.geom.LineString> lineStrings)Creates a MultiLineString using the given LineStrings; a null or empty collection will create an empty MultiLineString.static org.locationtech.jts.geom.MultiLineStringcreateMultiLineString(Collection<? extends org.locationtech.jts.geom.LineString> lineStrings, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a MultiLineString using the given LineStrings; a null or empty collection will create an empty MultiLineString.static org.locationtech.jts.geom.MultiPointcreateMultiPoint(Collection<? extends org.locationtech.jts.geom.Point> points)Creates a MultiPoint using the given Points.static org.locationtech.jts.geom.MultiPointcreateMultiPoint(Collection<? extends org.locationtech.jts.geom.Point> points, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a MultiPoint using the given Points.static org.locationtech.jts.geom.MultiPolygoncreateMultiPolygon(Collection<? extends org.locationtech.jts.geom.Polygon> polygons)Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon.static org.locationtech.jts.geom.MultiPolygoncreateMultiPolygon(Collection<? extends org.locationtech.jts.geom.Polygon> polygons, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon.static org.locationtech.jts.geom.PointcreatePoint(double x, double y)Creates a point.static org.locationtech.jts.geom.PointcreatePoint(double x, double y, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a point.static org.locationtech.jts.geom.PointcreatePoint(BigDecimal x, BigDecimal y)Creates a point.static org.locationtech.jts.geom.PointcreatePoint(BigDecimal x, BigDecimal y, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a point.static org.locationtech.jts.geom.PointcreatePoint(org.locationtech.jts.geom.Coordinate coordinate)Creates a Point using the given Coordinate; a null Coordinate will create an empty Geometry.static org.locationtech.jts.geom.PointcreatePoint(org.locationtech.jts.geom.Coordinate coordinate, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a Point using the given Coordinate; a null Coordinate will create an empty Geometry.static org.locationtech.jts.geom.PointcreatePointWGS84(double latitude, double longitude)Creates a point from WGS84 latitude and longitude.
Latitude becomes the y-value.
Longitude becomes the x-value.static org.locationtech.jts.geom.PointcreatePointWGS84(double latitude, double longitude, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a point from WGS84 latitude and longitude.
Latitude becomes the y-value.
Longitude becomes the x-value.static org.locationtech.jts.geom.PointcreatePointWGS84(BigDecimal latitude, BigDecimal longitude)Creates a point from WGS84 latitude and longitude.
Latitude becomes the y-value.
Longitude becomes the x-value.static org.locationtech.jts.geom.PointcreatePointWGS84(BigDecimal latitude, BigDecimal longitude, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a point from WGS84 latitude and longitude.
Latitude becomes the y-value.
Longitude becomes the x-value.static org.locationtech.jts.geom.PolygoncreatePolygon(org.locationtech.jts.geom.LinearRing shell)Constructs a Polygon with the given exterior boundary.static org.locationtech.jts.geom.PolygoncreatePolygon(org.locationtech.jts.geom.LinearRing shell, Collection<? extends org.locationtech.jts.geom.LinearRing> holes)Constructs a Polygon with the given exterior boundary and interior boundaries.static org.locationtech.jts.geom.PolygoncreatePolygon(org.locationtech.jts.geom.LinearRing shell, Collection<? extends org.locationtech.jts.geom.LinearRing> holes, org.locationtech.jts.geom.GeometryFactory geometryFactory)Constructs a Polygon with the given exterior boundary and interior boundaries.static org.locationtech.jts.geom.PolygoncreatePolygon(org.locationtech.jts.geom.LinearRing shell, org.locationtech.jts.geom.GeometryFactory geometryFactory)Constructs a Polygon with the given exterior boundary.static booleanequals(org.locationtech.jts.geom.Geometry g1, org.locationtech.jts.geom.Geometry g2)Checks whether two geometry objects are equal.static org.locationtech.jts.geom.GeometryfromWKT(InputStream inputStream, String charsetName)Reads a Well-Known Text representation of a Geometry from anInputStream.static org.locationtech.jts.geom.GeometryfromWKT(InputStream inputStream, String charsetName, org.locationtech.jts.geom.GeometryFactory geometryFactory)Reads a Well-Known Text representation of a Geometry from anInputStream.static org.locationtech.jts.geom.GeometryfromWKT(Reader reader)Reads a Well-Known Text representation of a Geometry from aReader.static org.locationtech.jts.geom.GeometryfromWKT(Reader reader, org.locationtech.jts.geom.GeometryFactory geometryFactory)Reads a Well-Known Text representation of a Geometry from aReader.static org.locationtech.jts.geom.GeometryfromWKT(String wkt)Reads a Well-Known Text representation of a Geometry from aString.static org.locationtech.jts.geom.GeometryfromWKT(String wkt, org.locationtech.jts.geom.GeometryFactory geometryFactory)Reads a Well-Known Text representation of a Geometry from aString.static double[]getBoundingBox(Collection<? extends org.locationtech.jts.geom.Geometry> geometries)Calculate the bounding box of the specified geometries.static double[]getBoundingBox(org.locationtech.jts.geom.Geometry geometry)Calculate the bounding box of the specified geometry (see bounding-boxes).static org.locationtech.jts.geom.PolygongetBoundingBoxAsPolygon2D(double[] boundingBox)Returns a polygon from the bounding box.static org.locationtech.jts.geom.PolygongetBoundingBoxAsPolygon2D(double[] boundingBox, org.locationtech.jts.geom.GeometryFactory geometryFactory)Returns a polygon from the bounding box.static org.locationtech.jts.geom.PolygongetBoundingBoxAsPolygon2D(org.locationtech.jts.geom.Geometry geometry)Returns the bounding box of the geometry as polygon.static org.locationtech.jts.geom.PolygongetBoundingBoxAsPolygon2D(org.locationtech.jts.geom.Geometry geometry, org.locationtech.jts.geom.GeometryFactory geometryFactory)Returns the bounding box of the geometry as polygon.static doublegetLatitudeWGS84(org.locationtech.jts.geom.Coordinate coordinate)Gets latitude value of WGS84.static doublegetLongitudeWGS84(org.locationtech.jts.geom.Coordinate coordinate)Gets longitude value of WGS84.static org.locationtech.jts.geom.CoordinategetNorthEast(double[] boundingBox)Returns the coordinate in the north-east.static org.locationtech.jts.geom.CoordinategetNorthWest(double[] boundingBox)Returns the coordinate in the north-west.static org.locationtech.jts.geom.CoordinategetSouthEast(double[] boundingBox)Returns the coordinate in the south-east.static org.locationtech.jts.geom.CoordinategetSouthWest(double[] boundingBox)Returns the coordinate in the south-west.static org.locationtech.jts.geom.GeometryswapCoordinates(org.locationtech.jts.geom.Geometry geometry)Swap coordinates.static StringtoWKT(org.locationtech.jts.geom.Geometry geometry)Returns the Well-known Text representation of this Geometry.static org.locationtech.jts.geom.GeometrytransformMercatorToWgs84(org.locationtech.jts.geom.Geometry geometry)Transforms the coordinates of the given geometry from mercator into WGS84.static org.locationtech.jts.geom.GeometrytransformWgs84ToMercator(org.locationtech.jts.geom.Geometry geometry)Transforms the coordinates of the given geometry from WGS84 into mercator.
-
-
-
Field Detail
-
EARTH_RADIUS_METERS
public static final double EARTH_RADIUS_METERS
The earth radius in meters.- See Also:
- Constant Field Values
-
MERCATOR_MAX_LAT
public static final double MERCATOR_MAX_LAT
Maximum latitude for mercator projection.- See Also:
- Constant Field Values
-
MERCATOR_MIN_LAT
public static final double MERCATOR_MIN_LAT
Minimum latitude for mercator projection.- See Also:
- Constant Field Values
-
DEFAULT_SPATIAL_AUTHORITY
public static final String DEFAULT_SPATIAL_AUTHORITY
Default spatial authority: 'EPSG'.- See Also:
- Constant Field Values
-
WGS84_SPATIAL_REFERENCE_ID
public static final int WGS84_SPATIAL_REFERENCE_ID
Reference ID of WGS84: '4326'.- See Also:
- Constant Field Values
-
WGS84_CRS
public static final String WGS84_CRS
CRS (Coordinate reference system) of WGS84: 'EPSG:4326'.- See Also:
- Constant Field Values
-
MERCATOR_SPATIAL_REFERENCE_ID
public static final int MERCATOR_SPATIAL_REFERENCE_ID
Reference ID of mercator projection: '3857'.- See Also:
- Constant Field Values
-
MERCATOR_SPATIAL_REFERENCE_ID_ALT
public static final int MERCATOR_SPATIAL_REFERENCE_ID_ALT
Alternative reference ID of mercator: '900913'.- See Also:
- Constant Field Values
-
MERCATOR_CRS
public static final String MERCATOR_CRS
CRS (Coordinate reference system) of mercator: 'EPSG:3857'.- See Also:
- Constant Field Values
-
MERCATOR_CRS_ALT
public static final String MERCATOR_CRS_ALT
Alternative CRS (Coordinate reference system) of mercator: 'EPSG:900913'.- See Also:
- Constant Field Values
-
-
Method Detail
-
equals
public static boolean equals(org.locationtech.jts.geom.Geometry g1, org.locationtech.jts.geom.Geometry g2)Checks whether two geometry objects are equal.Because the
Geometry.equals(Geometry)method throws an exception, this method is used in the GeoJSON classes.- Parameters:
g1- one geometryg2- another geometry- Returns:
trueif the geometries are equal otherwisefalse
-
getBoundingBox
public static double[] getBoundingBox(org.locationtech.jts.geom.Geometry geometry)
Calculate the bounding box of the specified geometry (see bounding-boxes).A GeoJSON object MAY have a member named "bbox" to include information on the coordinate range for its Geometries, Features, or FeatureCollections. The value of the bbox member MUST be an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries.
- Parameters:
geometry- the geometry- Returns:
nullif the bounding box can not be calculated, otherwise the bounding box
-
getBoundingBox
public static double[] getBoundingBox(Collection<? extends org.locationtech.jts.geom.Geometry> geometries)
Calculate the bounding box of the specified geometries.- Parameters:
geometries- the geometries- Returns:
nullif the bounding box can not be calculated, otherwise the bounding box
-
getSouthWest
public static org.locationtech.jts.geom.Coordinate getSouthWest(double[] boundingBox)
Returns the coordinate in the south-west.- Parameters:
boundingBox- the bounding box- Returns:
- the coordinate in the south-west
-
getNorthWest
public static org.locationtech.jts.geom.Coordinate getNorthWest(double[] boundingBox)
Returns the coordinate in the north-west.- Parameters:
boundingBox- the bounding box- Returns:
- the coordinate in the north-west
-
getNorthEast
public static org.locationtech.jts.geom.Coordinate getNorthEast(double[] boundingBox)
Returns the coordinate in the north-east.- Parameters:
boundingBox- the bounding box- Returns:
- the coordinate in the north-east
-
getSouthEast
public static org.locationtech.jts.geom.Coordinate getSouthEast(double[] boundingBox)
Returns the coordinate in the south-east.- Parameters:
boundingBox- the bounding box- Returns:
- the coordinate in the south-east
-
getBoundingBoxAsPolygon2D
public static org.locationtech.jts.geom.Polygon getBoundingBoxAsPolygon2D(double[] boundingBox)
Returns a polygon from the bounding box.- Parameters:
boundingBox- the bounding bos- Returns:
- the polygon or
nullif the bounding box isnullor empty
-
getBoundingBoxAsPolygon2D
public static org.locationtech.jts.geom.Polygon getBoundingBoxAsPolygon2D(double[] boundingBox, org.locationtech.jts.geom.GeometryFactory geometryFactory)Returns a polygon from the bounding box.- Parameters:
boundingBox- the bounding bosgeometryFactory- the geometry factory- Returns:
- the polygon or
nullif the bounding box isnullor empty
-
getBoundingBoxAsPolygon2D
public static org.locationtech.jts.geom.Polygon getBoundingBoxAsPolygon2D(org.locationtech.jts.geom.Geometry geometry)
Returns the bounding box of the geometry as polygon.- Parameters:
geometry- the geometry- Returns:
- the bounding box of the geometry as polygon
-
getBoundingBoxAsPolygon2D
public static org.locationtech.jts.geom.Polygon getBoundingBoxAsPolygon2D(org.locationtech.jts.geom.Geometry geometry, org.locationtech.jts.geom.GeometryFactory geometryFactory)Returns the bounding box of the geometry as polygon.- Parameters:
geometry- the geometrygeometryFactory- the geometry factory to use- Returns:
- the bounding box of the geometry as polygon
-
toWKT
public static String toWKT(org.locationtech.jts.geom.Geometry geometry)
Returns the Well-known Text representation of this Geometry. For a definition of the Well-known Text format, see the OpenGIS Simple Features Specification.- Parameters:
geometry- the geometry- Returns:
- the Well-known Text representation of this Geometry
-
fromWKT
public static org.locationtech.jts.geom.Geometry fromWKT(String wkt) throws IllegalArgumentException
Reads a Well-Known Text representation of a Geometry from aString.- Parameters:
wkt- one or more strings (see the OpenGIS Simple Features Specification) separated by whitespace- Returns:
- a Geometry specified by wellKnownText
- Throws:
IllegalArgumentException- if a parsing problem occurs
-
fromWKT
public static org.locationtech.jts.geom.Geometry fromWKT(String wkt, org.locationtech.jts.geom.GeometryFactory geometryFactory) throws IllegalArgumentException
Reads a Well-Known Text representation of a Geometry from aString.- Parameters:
wkt- one or more strings (see the OpenGIS Simple Features Specification) separated by whitespacegeometryFactory- the geometry factory to use- Returns:
- a Geometry specified by wellKnownText
- Throws:
IllegalArgumentException- if a parsing problem occurs
-
fromWKT
public static org.locationtech.jts.geom.Geometry fromWKT(Reader reader) throws IllegalArgumentException
Reads a Well-Known Text representation of a Geometry from aReader.- Parameters:
reader- aReaderwhich will return a string (see the OpenGIS Simple Features Specification)- Returns:
- a Geometry read from reader
- Throws:
IllegalArgumentException- if a parsing problem occurs
-
fromWKT
public static org.locationtech.jts.geom.Geometry fromWKT(Reader reader, org.locationtech.jts.geom.GeometryFactory geometryFactory) throws IllegalArgumentException
Reads a Well-Known Text representation of a Geometry from aReader.- Parameters:
reader- aReaderwhich will return a string (see the OpenGIS Simple Features Specification)geometryFactory- the geometry factory to use- Returns:
- a Geometry read from reader
- Throws:
IllegalArgumentException- if a parsing problem occurs
-
fromWKT
public static org.locationtech.jts.geom.Geometry fromWKT(InputStream inputStream, String charsetName) throws IllegalArgumentException
Reads a Well-Known Text representation of a Geometry from anInputStream.- Parameters:
inputStream- anInputStreamwhich will return a string (see the OpenGIS Simple Features Specification)charsetName- the charset to use- Returns:
- a Geometry read from the input stream
- Throws:
IllegalArgumentException- if a parsing problem occurs
-
fromWKT
public static org.locationtech.jts.geom.Geometry fromWKT(InputStream inputStream, String charsetName, org.locationtech.jts.geom.GeometryFactory geometryFactory) throws IllegalArgumentException
Reads a Well-Known Text representation of a Geometry from anInputStream.- Parameters:
inputStream- anInputStreamwhich will return a string (see the OpenGIS Simple Features Specification)charsetName- the charset to usegeometryFactory- the geometry factory to use- Returns:
- a Geometry read from the input stream
- Throws:
IllegalArgumentException- if a parsing problem occurs
-
createCoordinate
public static org.locationtech.jts.geom.Coordinate createCoordinate(double x, double y)Creates a coordinate.- Parameters:
x- the x valuey- the y value- Returns:
- the coordinate
-
createCoordinate
public static org.locationtech.jts.geom.Coordinate createCoordinate(BigDecimal x, BigDecimal y)
Creates a coordinate.- Parameters:
x- the x valuey- the y value- Returns:
- the coordinate
- Throws:
IllegalArgumentException- if x or y isnull
-
createCoordinateWGS84
public static org.locationtech.jts.geom.Coordinate createCoordinateWGS84(double latitude, double longitude)Creates a coordinate.- Parameters:
latitude- the latitude valuelongitude- the longitude value- Returns:
- the coordinate
-
createCoordinateWGS84
public static org.locationtech.jts.geom.Coordinate createCoordinateWGS84(BigDecimal latitude, BigDecimal longitude)
Creates a coordinate.- Parameters:
latitude- the latitude valuelongitude- the longitude value- Returns:
- the coordinate
- Throws:
IllegalArgumentException- if latitude or longitude isnull
-
getLatitudeWGS84
public static double getLatitudeWGS84(org.locationtech.jts.geom.Coordinate coordinate)
Gets latitude value of WGS84.- Parameters:
coordinate- the coordinate- Returns:
- the latitude
-
getLongitudeWGS84
public static double getLongitudeWGS84(org.locationtech.jts.geom.Coordinate coordinate)
Gets longitude value of WGS84.- Parameters:
coordinate- the coordinate- Returns:
- the longitude
-
createPoint
public static org.locationtech.jts.geom.Point createPoint(double x, double y)Creates a point.- Parameters:
x- the x valuey- the y value- Returns:
- the point
-
createPoint
public static org.locationtech.jts.geom.Point createPoint(double x, double y, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a point.- Parameters:
x- the x valuey- the y valuegeometryFactory- the geometry factory to use- Returns:
- the point
-
createPoint
public static org.locationtech.jts.geom.Point createPoint(BigDecimal x, BigDecimal y)
Creates a point.- Parameters:
x- the x valuey- the y value- Returns:
- the point
-
createPoint
public static org.locationtech.jts.geom.Point createPoint(BigDecimal x, BigDecimal y, org.locationtech.jts.geom.GeometryFactory geometryFactory)
Creates a point.- Parameters:
x- the x valuey- the y valuegeometryFactory- the geometry factory to use- Returns:
- the point
-
createPoint
public static org.locationtech.jts.geom.Point createPoint(org.locationtech.jts.geom.Coordinate coordinate)
Creates a Point using the given Coordinate; a null Coordinate will create an empty Geometry.- Parameters:
coordinate- the coordinate of the point- Returns:
- the point
-
createPoint
public static org.locationtech.jts.geom.Point createPoint(org.locationtech.jts.geom.Coordinate coordinate, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a Point using the given Coordinate; a null Coordinate will create an empty Geometry.- Parameters:
coordinate- the coordinate of the pointgeometryFactory- the geometry factory to use- Returns:
- the point
-
createPointWGS84
public static org.locationtech.jts.geom.Point createPointWGS84(double latitude, double longitude)Creates a point from WGS84 latitude and longitude.
Latitude becomes the y-value.
Longitude becomes the x-value.- Parameters:
latitude- the latitude in degreeslongitude- the longitude in degrees- Returns:
- the point
-
createPointWGS84
public static org.locationtech.jts.geom.Point createPointWGS84(BigDecimal latitude, BigDecimal longitude)
Creates a point from WGS84 latitude and longitude.
Latitude becomes the y-value.
Longitude becomes the x-value.- Parameters:
latitude- the latitude in degreeslongitude- the longitude in degrees- Returns:
- the point
-
createPointWGS84
public static org.locationtech.jts.geom.Point createPointWGS84(double latitude, double longitude, org.locationtech.jts.geom.GeometryFactory geometryFactory)Creates a point from WGS84 latitude and longitude.
Latitude becomes the y-value.
Longitude becomes the x-value.- Parameters:
latitude- the latitude in degreeslongitude- the longitude in degreesgeometryFactory- the geometry factory to use- Returns:
- the point
-
createPointWGS84
public static org.locationtech.jts.geom.Point createPointWGS84(BigDecimal latitude, BigDecimal longitude, org.locationtech.jts.geom.GeometryFactory geometryFactory)
Creates a point from WGS84 latitude and longitude.
Latitude becomes the y-value.
Longitude becomes the x-value.- Parameters:
latitude- the latitude in degreeslongitude- the longitude in degreesgeometryFactory- the geometry factory to use- Returns:
- the point
-
createMultiPoint
public static org.locationtech.jts.geom.MultiPoint createMultiPoint(Collection<? extends org.locationtech.jts.geom.Point> points)
Creates a MultiPoint using the given Points. A null or empty collection will create an empty MultiPoint.- Parameters:
points- the points of theMultiPoint- Returns:
- the
MultiPoint
-
createMultiPoint
public static org.locationtech.jts.geom.MultiPoint createMultiPoint(Collection<? extends org.locationtech.jts.geom.Point> points, org.locationtech.jts.geom.GeometryFactory geometryFactory)
Creates a MultiPoint using the given Points. A null or empty collection will create an empty MultiPoint.- Parameters:
points- the points of theMultiPointgeometryFactory- the geometry factory to use- Returns:
- the
MultiPoint
-
createLineString
public static org.locationtech.jts.geom.LineString createLineString(Collection<? extends org.locationtech.jts.geom.Coordinate> coordinates)
Creates a LineString using the given coordinates; a null or empty collection will create an empty LineString. Consecutive points must not be equal.- Parameters:
coordinates- the coordinates of theLineString- Returns:
- the
LineString
-
createLineString
public static org.locationtech.jts.geom.LineString createLineString(Collection<? extends org.locationtech.jts.geom.Coordinate> coordinates, org.locationtech.jts.geom.GeometryFactory geometryFactory)
Creates a LineString using the given coordinates; a null or empty collection will create an empty LineString. Consecutive points must not be equal.- Parameters:
coordinates- the coordinates of theLineStringgeometryFactory- the geometry factory to use- Returns:
- the
LineString
-
createMultiLineString
public static org.locationtech.jts.geom.MultiLineString createMultiLineString(Collection<? extends org.locationtech.jts.geom.LineString> lineStrings)
Creates a MultiLineString using the given LineStrings; a null or empty collection will create an empty MultiLineString.- Parameters:
lineStrings- theLineStrings of theMultiLineString- Returns:
- the
MultiLineString
-
createMultiLineString
public static org.locationtech.jts.geom.MultiLineString createMultiLineString(Collection<? extends org.locationtech.jts.geom.LineString> lineStrings, org.locationtech.jts.geom.GeometryFactory geometryFactory)
Creates a MultiLineString using the given LineStrings; a null or empty collection will create an empty MultiLineString.- Parameters:
lineStrings- theLineStrings of theMultiLineStringgeometryFactory- the geometry factory to use- Returns:
- the
MultiLineString
-
createLinearRing
public static org.locationtech.jts.geom.LinearRing createLinearRing(Collection<? extends org.locationtech.jts.geom.Coordinate> coordinates)
Creates a LinearRing using the given coordinates. A null or empty coordinates will create an empty LinearRing.- Parameters:
coordinates- the coordinates- Returns:
- the created LinearRing
-
createLinearRing
public static org.locationtech.jts.geom.LinearRing createLinearRing(Collection<? extends org.locationtech.jts.geom.Coordinate> coordinates, org.locationtech.jts.geom.GeometryFactory geometryFactory)
Creates a LinearRing using the given coordinates. A null or empty coordinates will create an empty LinearRing.- Parameters:
coordinates- the coordinatesgeometryFactory- the geometry factory- Returns:
- the created LinearRing
-
createPolygon
public static org.locationtech.jts.geom.Polygon createPolygon(org.locationtech.jts.geom.LinearRing shell)
Constructs a Polygon with the given exterior boundary.- Parameters:
shell- the outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be created- Returns:
- the created Polygon
-
createPolygon
public static org.locationtech.jts.geom.Polygon createPolygon(org.locationtech.jts.geom.LinearRing shell, org.locationtech.jts.geom.GeometryFactory geometryFactory)Constructs a Polygon with the given exterior boundary.- Parameters:
shell- the outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be createdgeometryFactory- the geometry factory- Returns:
- the created Polygon
-
createPolygon
public static org.locationtech.jts.geom.Polygon createPolygon(org.locationtech.jts.geom.LinearRing shell, Collection<? extends org.locationtech.jts.geom.LinearRing> holes)Constructs a Polygon with the given exterior boundary and interior boundaries.- Parameters:
shell- the outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be createdholes- the inner boundaries of the new Polygon, or null or empty LinearRing s if the empty geometry is to be created- Returns:
- the created Polygon
-
createPolygon
public static org.locationtech.jts.geom.Polygon createPolygon(org.locationtech.jts.geom.LinearRing shell, Collection<? extends org.locationtech.jts.geom.LinearRing> holes, org.locationtech.jts.geom.GeometryFactory geometryFactory)Constructs a Polygon with the given exterior boundary and interior boundaries.- Parameters:
shell- the outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be createdholes- the inner boundaries of the new Polygon, or null or empty LinearRing s if the empty geometry is to be createdgeometryFactory- the geometry factory- Returns:
- the created Polygon
-
createMultiPolygon
public static org.locationtech.jts.geom.MultiPolygon createMultiPolygon(Collection<? extends org.locationtech.jts.geom.Polygon> polygons)
Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon.- Parameters:
polygons- the polygons- Returns:
- the multi polygon
-
createMultiPolygon
public static org.locationtech.jts.geom.MultiPolygon createMultiPolygon(Collection<? extends org.locationtech.jts.geom.Polygon> polygons, org.locationtech.jts.geom.GeometryFactory geometryFactory)
Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon.- Parameters:
polygons- the polygonsgeometryFactory- the geometry factory- Returns:
- the multi polygon
-
createGeometryCollection
public static org.locationtech.jts.geom.GeometryCollection createGeometryCollection(org.locationtech.jts.geom.Geometry... geometries)
Create geometry collection geometry collection.- Parameters:
geometries- the geometries- Returns:
- the geometry collection
-
createGeometryCollection
public static org.locationtech.jts.geom.GeometryCollection createGeometryCollection(Collection<? extends org.locationtech.jts.geom.Geometry> geometries)
Create geometry collection geometry collection.- Parameters:
geometries- the geometries- Returns:
- the geometry collection
-
createGeometryCollection
public static org.locationtech.jts.geom.GeometryCollection createGeometryCollection(Collection<? extends org.locationtech.jts.geom.Geometry> geometries, org.locationtech.jts.geom.GeometryFactory geometryFactory)
Create geometry collection geometry collection.- Parameters:
geometries- the geometriesgeometryFactory- the geometry factory- Returns:
- the geometry collection
-
copyAndApplyFilters
public static org.locationtech.jts.geom.Geometry copyAndApplyFilters(org.locationtech.jts.geom.Geometry geometry, org.locationtech.jts.geom.CoordinateFilter... filters)Copy and apply filters.- Parameters:
geometry- the geometryfilters- the filters- Returns:
- the copied and filtered geometry
-
transformWgs84ToMercator
public static org.locationtech.jts.geom.Geometry transformWgs84ToMercator(org.locationtech.jts.geom.Geometry geometry)
Transforms the coordinates of the given geometry from WGS84 into mercator.- Parameters:
geometry- the geometry- Returns:
- the transformed (cloned) geometry
-
transformMercatorToWgs84
public static org.locationtech.jts.geom.Geometry transformMercatorToWgs84(org.locationtech.jts.geom.Geometry geometry)
Transforms the coordinates of the given geometry from mercator into WGS84.- Parameters:
geometry- the geometry- Returns:
- the transformed (cloned) geometry
-
swapCoordinates
public static org.locationtech.jts.geom.Geometry swapCoordinates(org.locationtech.jts.geom.Geometry geometry)
Swap coordinates.- Parameters:
geometry- the geometry- Returns:
- the geometry with swapped coordinates
-
-