public final class CRSUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.opengis.referencing.crs.CRSAuthorityFactory |
crsFactory |
static String |
DEFAULT_CRS
Default is CRS:84 (EPSG:4326 with lon/lat ordering).
|
static int |
EPSG_WGS84 |
| Modifier and Type | Method and Description |
|---|---|
GeojsonPoint |
convertToGeojsonFrom(com.vividsolutions.jts.geom.Point point)
Creates a GeoJSON representation for the given point.
|
GeojsonPoint |
convertToGeojsonFrom(com.vividsolutions.jts.geom.Point point,
String targetCrs)
Creates a GeoJSON representation of the given point.
|
com.vividsolutions.jts.geom.Point |
convertToPointFrom(GeojsonPoint geometry) |
com.vividsolutions.jts.geom.Point |
convertToPointFrom(GeojsonPoint geometry,
String crs) |
static CRSUtils |
createEpsgForcedXYAxisOrder()
Creates a
CRSUtils which offers assistance when doing spatial opererations. |
static CRSUtils |
createEpsgReferenceHelper(org.geotools.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. |
(package private) com.vividsolutions.jts.geom.GeometryFactory |
createGeometryFactory(String srsId) |
com.vividsolutions.jts.geom.Geometry |
createLineString(com.vividsolutions.jts.geom.Coordinate[] coordinates,
String srs) |
com.vividsolutions.jts.geom.Point |
createPoint(Double x,
Double y,
Double z,
String srs)
Creates a 2D point geometry with respect to its height and given reference system.
|
com.vividsolutions.jts.geom.Point |
createPoint(Double x,
Double y,
String srs)
Creates a 2D point geometry within the given reference system.
|
String |
extractSRSCode(String srs) |
int |
getSrsIdFrom(String srs)
Extracts the SRS number of the incoming SRS definition string.
|
int |
getSrsIdFromEPSG(String srs) |
boolean |
isLatLonAxesOrder(String outer)
Indicates if the given reference frame has switched axes compared to the inner default
(lon/lat).
|
com.vividsolutions.jts.geom.Geometry |
parseWkt(String wkt) |
com.vividsolutions.jts.geom.Geometry |
transform(com.vividsolutions.jts.geom.Geometry geometry,
String srcFrame,
String destFrame)
Transforms a given geometry from a given reference to a destinated reference.
|
com.vividsolutions.jts.geom.Geometry |
transformInnerToOuter(com.vividsolutions.jts.geom.Geometry geometry,
String destFrame)
Transforms a given geometry from its inner reference (which is WGS84 (CRS:84)) to a given
reference.
|
com.vividsolutions.jts.geom.Geometry |
transformOuterToInner(com.vividsolutions.jts.geom.Geometry geometry,
String srcFrame)
Transforms a given geometry from a given reference to inner reference, which is WGS84
(CRS:84).
|
public static final int EPSG_WGS84
public static final String DEFAULT_CRS
protected org.opengis.referencing.crs.CRSAuthorityFactory crsFactory
public com.vividsolutions.jts.geom.Point convertToPointFrom(GeojsonPoint geometry)
public com.vividsolutions.jts.geom.Point convertToPointFrom(GeojsonPoint geometry, String crs)
public GeojsonPoint convertToGeojsonFrom(com.vividsolutions.jts.geom.Point point)
point - the point to convert.public GeojsonPoint convertToGeojsonFrom(com.vividsolutions.jts.geom.Point point, String targetCrs) throws org.opengis.referencing.operation.TransformException, org.opengis.referencing.FactoryException
crs member if
it is different to the internally used CRS:84.point - the point to be converted to GeoJSON.targetCrs - the target CRS.org.opengis.referencing.operation.TransformException - if transforming point fails.org.opengis.referencing.FactoryException - if creating the target CRS fails.public com.vividsolutions.jts.geom.Point createPoint(Double x, Double y, 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 com.vividsolutions.jts.geom.Point createPoint(Double x, Double y, Double z, 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 com.vividsolutions.jts.geom.Geometry createLineString(com.vividsolutions.jts.geom.Coordinate[] coordinates,
String srs)
com.vividsolutions.jts.geom.GeometryFactory createGeometryFactory(String srsId)
public int getSrsIdFrom(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 String extractSRSCode(String srs)
srs - the SRS definition string, either as URL ('/'-separated) or as URN
(': '-separated).public int getSrsIdFromEPSG(String srs)
public com.vividsolutions.jts.geom.Geometry transformOuterToInner(com.vividsolutions.jts.geom.Geometry geometry,
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 com.vividsolutions.jts.geom.Geometry transformInnerToOuter(com.vividsolutions.jts.geom.Geometry geometry,
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 com.vividsolutions.jts.geom.Geometry transform(com.vividsolutions.jts.geom.Geometry geometry,
String srcFrame,
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 com.vividsolutions.jts.geom.Geometry parseWkt(String wkt)
public boolean isLatLonAxesOrder(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.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.IllegalStateException - if decoding default CRS fails.public static CRSUtils createEpsgReferenceHelper(org.geotools.factory.Hints hints) throws 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 hintsIllegalStateExceptionCopyright © 2013–2017 52North Initiative for Geospatial Open Source Software GmbH. All rights reserved.