public final class CoordinateReferenceProvider extends Object
Modifier and Type | Method and Description |
---|---|
static CoordinateReference |
create(String identifier)
Creates the coordinate reference from a given EPSG, WKT (version 1) or OGC identifier.
|
@NotNull public static CoordinateReference create(@NotNull String identifier) throws ParseException
A list of supported epsg references can be found here.
Example usage:
Creation of the WGS-84 coordinate reference system with an EPSG identifier.
String identifier = "EPSG:4326";
CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
Creation of the WGS-84 coordinate reference system with a WKT identifier.
String identifier = "GEOGCS[\"WGS 84\",DATUM[\"World Geodetic System 1984\",SPHEROID[\"WGS 84\",6378137.0,298.257223563],TOWGS84[0.0,0.0,0.0]],PRIMEM[\"Greenwich\",0.0],UNIT[\"degree\",0.017453292519943295],AXIS[\"Geodetic latitude\",NORTH],AXIS[\"Geodetic longitude\",EAST],AUTHORITY[\"EPSG\",4326]]";
CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
Creation of the Web Mercator coordinate reference system with an OGC identifier.
String identifier = "urn:ogc:def:crs:EPSG::3857";
CoordinateReference crs = CoordinateReferenceProvider.create(identifier);
identifier
- an EPSG, WKT (version 1) or OGC identifier, for example "EPSG:3857" or "urn:ogc:def:crs:EPSG::3857".ParseException
- when the coordinate reference is not supported or cannot be parsed.