public final class CRSUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected org.opengis.referencing.crs.CRSAuthorityFactory |
crsFactory |
static java.lang.String |
DEFAULT_CRS
Default is CRS:84 (EPSG:4326 with lon/lat ordering).
|
static int |
EPSG_WGS84 |
| Modifier and Type | Method and Description |
|---|---|
static CRSUtils |
createEpsgForcedXYAxisOrder()
Creates a
CRSUtils which offers assistance when doing spatial opererations. |
static CRSUtils |
createEpsgReferenceHelper(org.geotools.util.factory.Hints hints)
Creates a
CRSUtils which offers assistance when doing spatial opererations. |
static CRSUtils |
createEpsgStrictAxisOrder()
Creates an
CRSUtils which offers assistance when doing spatial opererations. |
org.locationtech.jts.geom.GeometryFactory |
createGeometryFactory() |
org.locationtech.jts.geom.GeometryFactory |
createGeometryFactory(java.lang.String srsId) |
org.locationtech.jts.geom.Geometry |
createLineString(org.locationtech.jts.geom.Coordinate[] coordinates,
java.lang.String srs) |
org.locationtech.jts.geom.Point |
createPoint(java.lang.Double x,
java.lang.Double y,
java.lang.Double z,
java.lang.String srs)
Creates a 2D point geometry with respect to its height and given reference system.
|
org.locationtech.jts.geom.Point |
createPoint(java.lang.Double x,
java.lang.Double y,
java.lang.String srs)
Creates a 2D point geometry within the given reference system.
|
static java.lang.String |
extractSRSCode(java.lang.String srs) |
static int |
getSrsIdFrom(java.lang.String srs)
Extracts the SRS number of the incoming SRS definition string.
|
static int |
getSrsIdFromEPSG(java.lang.String srs) |
boolean |
isLatLonAxesOrder(java.lang.String outer)
Indicates if the given reference frame has switched axes compared to the inner default (lon/lat).
|
org.locationtech.jts.geom.Geometry |
parseWkt(java.lang.String wkt) |
org.locationtech.jts.geom.Geometry |
transform(org.locationtech.jts.geom.Geometry geometry,
java.lang.String srcFrame,
java.lang.String destFrame)
Transforms a given geometry from a given reference to a destinated reference.
|
org.locationtech.jts.geom.Geometry |
transformInnerToOuter(org.locationtech.jts.geom.Geometry geometry,
java.lang.String destFrame)
Transforms a given geometry from its inner reference (which is WGS84 (CRS:84)) to a given reference.
|
org.locationtech.jts.geom.Geometry |
transformOuterToInner(org.locationtech.jts.geom.Geometry geometry,
java.lang.String srcFrame)
Transforms a given geometry from a given reference to inner reference, which is WGS84 (CRS:84).
|
org.locationtech.jts.geom.Point |
transformOuterToInner(org.locationtech.jts.geom.Point point,
java.lang.String srcFrame)
Transforms a given point from a given reference to inner reference, which is WGS84 (CRS:84).
|
public static final int EPSG_WGS84
public static final java.lang.String DEFAULT_CRS
protected org.opengis.referencing.crs.CRSAuthorityFactory crsFactory
public org.locationtech.jts.geom.Point createPoint(java.lang.Double x,
java.lang.Double y,
java.lang.String srs)
x - the coordinate's x value.y - the coordinate's y value.srs - an authoritive spatial reference system code, e.g. EPSG:4326 or CRS:84
.public org.locationtech.jts.geom.Point createPoint(java.lang.Double x,
java.lang.Double y,
java.lang.Double z,
java.lang.String srs)
x - the point's x value.y - the point's y value.z - the height or null or NaN if coordinate is 2D.srs - an authoritive spatial reference system code, e.g. EPSG:4326 or CRS:84
.public org.locationtech.jts.geom.Geometry createLineString(org.locationtech.jts.geom.Coordinate[] coordinates,
java.lang.String srs)
public org.locationtech.jts.geom.GeometryFactory createGeometryFactory()
public org.locationtech.jts.geom.GeometryFactory createGeometryFactory(java.lang.String srsId)
public static int getSrsIdFrom(java.lang.String srs)
http://www.opengis.net/def/crs/EPSG/0/4326) or a URN (like
urn:ogc:def:crs:EPSG::31466).srs - the SRS definition string, either as URL ('/'-separated) or as URN (':
'-separated).public static java.lang.String extractSRSCode(java.lang.String srs)
srs - the SRS definition string, either as URL ('/'-separated) or as URN (':
'-separated).public static int getSrsIdFromEPSG(java.lang.String srs)
public org.locationtech.jts.geom.Point transformOuterToInner(org.locationtech.jts.geom.Point point,
java.lang.String srcFrame)
throws org.opengis.referencing.FactoryException,
org.opengis.referencing.operation.TransformException
point - the point to transform.srcFrame - the CRS authority code the given point is referenced in.org.opengis.referencing.FactoryException - if the creation of CoordinateReferenceSystem fails or no appropriate
MathTransform could be createdorg.opengis.referencing.operation.TransformException - if transformation fails for any other reasonpublic org.locationtech.jts.geom.Geometry transformOuterToInner(org.locationtech.jts.geom.Geometry geometry,
java.lang.String srcFrame)
throws org.opengis.referencing.FactoryException,
org.opengis.referencing.operation.TransformException
geometry - the geometry to transform.srcFrame - the CRS authority code the given point is referenced in.org.opengis.referencing.FactoryException - if the creation of CoordinateReferenceSystem fails or no appropriate
MathTransform could be created.org.opengis.referencing.operation.TransformException - if transformation fails for any other reason.public org.locationtech.jts.geom.Geometry transformInnerToOuter(org.locationtech.jts.geom.Geometry geometry,
java.lang.String destFrame)
throws org.opengis.referencing.FactoryException,
org.opengis.referencing.operation.TransformException
geometry - the geometry to transform.destFrame - the CRS authority code the given point shall be transformed to.org.opengis.referencing.FactoryException - if the creation of CoordinateReferenceSystem fails or no appropriate
MathTransform could be created.org.opengis.referencing.operation.TransformException - if transformation fails for any other reason.public org.locationtech.jts.geom.Geometry transform(org.locationtech.jts.geom.Geometry geometry,
java.lang.String srcFrame,
java.lang.String destFrame)
throws org.opengis.referencing.FactoryException,
org.opengis.referencing.operation.TransformException
geometry - the geometry to transform.srcFrame - the reference the given point is in.destFrame - the reference frame the point shall be transformed to.org.opengis.referencing.FactoryException - if the creation of CoordinateReferenceSystem fails or no appropriate
MathTransform could be created.org.opengis.referencing.operation.TransformException - if transformation fails for any other reason.public org.locationtech.jts.geom.Geometry parseWkt(java.lang.String wkt)
public boolean isLatLonAxesOrder(java.lang.String outer)
throws org.opengis.referencing.FactoryException
outer - the given reference frame code to check.true if axes order is switched compared to the inner default.org.opengis.referencing.FactoryException - if no proper CRS could be created.public static CRSUtils createEpsgStrictAxisOrder()
CRSUtils which offers assistance when doing spatial opererations. Strict means that
all CRS defined with lat/lon axis ordering will be handled as defined.java.lang.IllegalStateException - if decoding default CRS fails.public static CRSUtils createEpsgForcedXYAxisOrder()
CRSUtils which offers assistance when doing spatial opererations. Forcing XY means
that CRS axis ordering is considered lon/lat ordering, even if defined lat/lon.java.lang.IllegalStateException - if decoding default CRS fails.public static CRSUtils createEpsgReferenceHelper(org.geotools.util.factory.Hints hints) throws java.lang.IllegalStateException
CRSUtils which offers assistance when doing spatial opererations.hints - Some Geotools Hints which set behavior and special considerations regarding to the
spatial operations.CRSUtils using given hintsjava.lang.IllegalStateExceptionCopyright © 2013–2019 52North Initiative for Geospatial Open Source Software GmbH. All rights reserved.