public class EPSGDataAccess extends GeodeticAuthorityFactory implements CRSAuthorityFactory, CSAuthorityFactory, DatumAuthorityFactory, CoordinateOperationAuthorityFactory, Localized, AutoCloseable
createProjectedCRS("3395")
and createProjectedCRS("WGS 84 / World Mercator")
both fetch
the same object.
However, names may be ambiguous since the same name may be used for more than one object.
This is the case of "WGS 84" for instance.
If such an ambiguity is found, an exception will be thrown.
EPSGDataAccess
instances should be short-lived since they may hold a significant amount of JDBC resources.
EPSGDataAccess
instances are created on the fly by EPSGFactory
and closed after a relatively short
timeout.
In addition EPSGFactory
caches the most recently created objects, which reduce greatly
the amount of EPSGDataAccess
instantiations (and consequently the amount of database accesses)
in the common case where only a few EPSG codes are used by an application.
EPSGDataAccess.createFoo(String)
methods do not cache by themselves and query the database on every invocation.
SQLTranslator
instance is provided to the constructor.Defined in the sis-referencing
module
Modifier and Type | Field and Description |
---|---|
protected Connection |
connection
The connection to the EPSG database.
|
protected EPSGFactory |
owner
The
ConcurrentAuthorityFactory that created this Data Access Object (DAO). |
protected SQLTranslator |
translator
The translator from the SQL statements using MS-Access dialect
to SQL statements using the dialect of the actual database.
|
Modifier | Constructor and Description |
---|---|
protected |
EPSGDataAccess(EPSGFactory owner,
Connection connection,
SQLTranslator translator)
Creates a factory using the given connection.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the JDBC connection used by this factory.
|
CoordinateOperation |
createCoordinateOperation(String code)
Creates an operation for transforming coordinates in the source CRS to coordinates in the target CRS.
|
CoordinateReferenceSystem |
createCoordinateReferenceSystem(String code)
Creates an arbitrary coordinate reference system from a code.
|
CoordinateSystem |
createCoordinateSystem(String code)
Creates an arbitrary coordinate system from a code.
|
CoordinateSystemAxis |
createCoordinateSystemAxis(String code)
Creates a coordinate system axis with name, direction, unit and range of values.
|
Datum |
createDatum(String code)
Creates an arbitrary datum from a code.
|
Ellipsoid |
createEllipsoid(String code)
Creates a geometric figure that can be used to describe the approximate shape of the earth.
|
Extent |
createExtent(String code)
Creates information about spatial, vertical, and temporal extent (usually a domain of validity) from a code.
|
Set<CoordinateOperation> |
createFromCoordinateReferenceSystemCodes(String sourceCRS,
String targetCRS)
Creates operations from source and target coordinate reference system codes.
|
IdentifiedObject |
createObject(String code)
Returns an arbitrary object from a code.
|
OperationMethod |
createOperationMethod(String code)
Creates description of the algorithm and parameters used to perform a coordinate operation.
|
ParameterDescriptor<?> |
createParameterDescriptor(String code)
Creates a definition of a single parameter used by an operation method.
|
PrimeMeridian |
createPrimeMeridian(String code)
Creates a prime meridian defining the origin from which longitude values are determined.
|
Unit<?> |
createUnit(String code)
Creates an unit of measurement from a code.
|
Citation |
getAuthority()
Returns the authority for this EPSG dataset.
|
Set<String> |
getAuthorityCodes(Class<? extends IdentifiedObject> type)
Returns the set of authority codes of the given type.
|
Set<String> |
getCodeSpaces()
Returns an empty set since this data access class expects no namespace.
|
InternationalString |
getDescriptionText(String code)
Gets a description of the object corresponding to a code.
|
Locale |
getLocale()
Returns the locale used by this factory for producing error messages.
|
IdentifiedObjectFinder |
newIdentifiedObjectFinder()
Returns a finder which can be used for looking up unidentified objects.
|
createCartesianCS, createCompoundCRS, createCylindricalCS, createDerivedCRS, createEllipsoidalCS, createEngineeringCRS, createEngineeringDatum, createGeocentricCRS, createGeodeticDatum, createGeographicCRS, createImageCRS, createImageDatum, createParametricCRS, createParametricCS, createParametricDatum, createPolarCS, createProjectedCRS, createSphericalCS, createTemporalCRS, createTemporalDatum, createTimeCS, createVerticalCRS, createVerticalCS, createVerticalDatum, toString, trimNamespace
getVendor
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createCompoundCRS, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRS
createCartesianCS, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createVerticalCS
createEngineeringDatum, createGeodeticDatum, createImageDatum, createTemporalDatum, createVerticalDatum
getVendor
protected final EPSGFactory owner
ConcurrentAuthorityFactory
that created this Data Access Object (DAO).
The owner supplies caching for all createFoo(String)
methods.protected final Connection connection
close()
method.close()
protected final SQLTranslator translator
protected EPSGDataAccess(EPSGFactory owner, Connection connection, SQLTranslator translator)
EPSGDataAccess
instances should not be created as standalone factories.
This constructor is for allowing definition of custom EPSGDataAccess
subclasses, which are then instantiated
by the EPSGFactory.newDataAccess(Connection, SQLTranslator)
method of a corresponding custom
EPSGFactory
subclass.owner
- the EPSGFactory
which is creating this Data Access Object (DAO).connection
- the connection to the underlying EPSG database.translator
- the translator from the SQL statements using MS-Access dialect
to SQL statements using the dialect of the actual database.EPSGFactory.newDataAccess(Connection, SQLTranslator)
public Locale getLocale()
getLocale
in interface Localized
public Citation getAuthority()
Citation ├─ Title ……………………………………………………… EPSG Geodetic Parameter Dataset ├─ Identifier ………………………………………… EPSG ├─ Online resource (1 of 2) │ ├─ Linkage ………………………………………… http://epsg-registry.org/ │ └─ Function ……………………………………… Browse └─ Online resource (2 of 2) ├─ Linkage ………………………………………… jdbc:derby:/my/path/to/SIS_DATA/Databases/SpatialMetadata ├─ Description ……………………………… EPSG dataset version 8.9 on “Apache Derby Embedded JDBC Driver” version 10.12. └─ Function ……………………………………… Connection
getAuthority
in interface AuthorityFactory
getAuthority
in class GeodeticAuthorityFactory
null
if unknown.AbstractFactory.getVendor()
public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type) throws FactoryException
getAuthorityCodes(type).containsAll(others)The returned set should not be referenced for a long time, as it may prevent this factory to release JDBC resources. If the set of codes is needed for a long time, their values should be copied in another collection object.
Set.size()
value,
Set.toString()
result, etc. with one exception:
a call to Set.contains(…)
will return true
if the given identifier exists
for a deprecated object, even if that identifier does not show up in iterations.
An other point of view could be to said that the returned collection behaves as if the deprecated codes were included in the set but invisible.
getAuthorityCodes
in interface AuthorityFactory
type
- the spatial reference objects type (may be Object.class
).FactoryException
- if access to the underlying database failed.public Set<String> getCodeSpaces()
createFoo(String)
methods directly, without "EPSG:"
prefix.getCodeSpaces
in class GeodeticAuthorityFactory
public InternationalString getDescriptionText(String code) throws NoSuchAuthorityCodeException, FactoryException
IdentifiedObject
.getDescriptionText
in interface AuthorityFactory
getDescriptionText
in class GeodeticAuthorityFactory
code
- value allocated by authority.null
if the object corresponding to the specified code
has no name.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the query failed for some other reason.public IdentifiedObject createObject(String code) throws NoSuchAuthorityCodeException, FactoryException
createCoordinateReferenceSystem(String)
, createDatum(String)
, etc.
until a successful one is found.
Note that this method may be ambiguous since the same EPSG code can be used for different
kind of objects. This method throws an exception if it detects an ambiguity on a best-effort basis.
It is recommended to invoke the most specific createFoo(String)
method when the desired type is known,
both for performance reason and for avoiding ambiguity.
createObject
in interface AuthorityFactory
createObject
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.createCoordinateReferenceSystem(String)
,
createDatum(String)
,
createCoordinateSystem(String)
public CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws NoSuchAuthorityCodeException, FactoryException
GeographicCRS
, ProjectedCRS
,
VerticalCRS
or CompoundCRS
.
Code | Type | Description |
---|---|---|
4326 | Geographic | World Geodetic System 1984 |
4979 | Geographic 3D | World Geodetic System 1984 |
4978 | Geocentric | World Geodetic System 1984 |
3395 | Projected | WGS 84 / World Mercator |
5714 | Vertical | Mean Sea Level height |
6349 | Compound | NAD83(2011) + NAVD88 height |
5800 | Engineering | Astra Minas Grid |
createCoordinateReferenceSystem
in interface CRSAuthorityFactory
createCoordinateReferenceSystem
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.AbstractCRS
,
CRS.forCode(String)
public Datum createDatum(String code) throws NoSuchAuthorityCodeException, FactoryException
GeodeticDatum
, VerticalDatum
or TemporalDatum
.
Code | Type | Description |
---|---|---|
6326 | Geodetic | World Geodetic System 1984 |
6322 | Geodetic | World Geodetic System 1972 |
1027 | Vertical | EGM2008 geoid |
5100 | Vertical | Mean Sea Level |
9315 | Engineering | Seismic bin grid datum |
createDatum
in interface DatumAuthorityFactory
createDatum
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.AbstractDatum
public Ellipsoid createEllipsoid(String code) throws NoSuchAuthorityCodeException, FactoryException
Code | Description |
---|---|
7030 | WGS 84 |
7034 | Clarke 1880 |
7048 | GRS 1980 Authalic Sphere |
createEllipsoid
in interface DatumAuthorityFactory
createEllipsoid
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.GeodeticAuthorityFactory.createGeodeticDatum(String)
,
GeodeticAuthorityFactory.createEllipsoidalCS(String)
,
DefaultEllipsoid
public PrimeMeridian createPrimeMeridian(String code) throws NoSuchAuthorityCodeException, FactoryException
Code | Description |
---|---|
8901 | Greenwich |
8903 | Paris |
8904 | Bogota |
8905 | Madrid |
8906 | Rome |
createPrimeMeridian
in interface DatumAuthorityFactory
createPrimeMeridian
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.GeodeticAuthorityFactory.createGeodeticDatum(String)
,
DefaultPrimeMeridian
public Extent createExtent(String code) throws NoSuchAuthorityCodeException, FactoryException
Code | Description |
---|---|
1262 | World |
3391 | World - between 80°S and 84°N |
createExtent
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.createCoordinateReferenceSystem(String)
,
createDatum(String)
,
DefaultExtent
public CoordinateSystem createCoordinateSystem(String code) throws NoSuchAuthorityCodeException, FactoryException
EllipsoidalCS
, CartesianCS
or VerticalCS
.
Code | Type | Axes | Orientations | Unit |
---|---|---|---|---|
4406 | Cartesian 2D CS | easting, northing (E,N) | east, north | kilometre |
4496 | Cartesian 2D CS | easting, northing (E,N) | east, north | metre |
4500 | Cartesian 2D CS | northing, easting (N,E) | north, east | metre |
4491 | Cartesian 2D CS | westing, northing (W,N) | west, north | metre |
6422 | Ellipsoidal 2D CS | latitude, longitude | north, east | degree |
6424 | Ellipsoidal 2D CS | longitude, latitude | east, north | degree |
6429 | Ellipsoidal 2D CS | longitude, latitude | east, north | radian |
6423 | Ellipsoidal 3D CS | latitude, longitude, ellipsoidal height | north, east, up | degree, degree, metre |
6404 | Spherical 3D CS | latitude, longitude, radius | north, east, up | degree, degree, metre |
6498 | Vertical CS | depth (D) | down | metre |
6499 | Vertical CS | height (H) | up | metre |
createCoordinateSystem
in interface CSAuthorityFactory
createCoordinateSystem
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.AbstractCS
,
CoordinateSystems.getEpsgCode(Unit, AxisDirection...)
public CoordinateSystemAxis createCoordinateSystemAxis(String code) throws NoSuchAuthorityCodeException, FactoryException
Code | Description | Unit |
---|---|---|
106 | Latitude (φ) | degree |
107 | Longitude (λ) | degree |
1 | Easting (E) | metre |
2 | Northing (N) | metre |
createCoordinateSystemAxis
in interface CSAuthorityFactory
createCoordinateSystemAxis
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.createCoordinateSystem(String)
,
DefaultCoordinateSystemAxis
public Unit<?> createUnit(String code) throws NoSuchAuthorityCodeException, FactoryException
Units.valueOfEPSG(int)
can provide a hard-coded unit
for the given code before to try to parse the information found in the database. This is done that
way for better support of non-straightforward units like sexagesimal degrees
(EPSG:9110 and 9111).
Code | Description |
---|---|
9002 | decimal degree |
9001 | metre |
9030 | kilometre |
1040 | second |
1029 | year |
createUnit
in interface CSAuthorityFactory
createUnit
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.Units.valueOfEPSG(int)
public ParameterDescriptor<?> createParameterDescriptor(String code) throws NoSuchAuthorityCodeException, FactoryException
Code | Description |
---|---|
8801 | Latitude of natural origin |
8802 | Longitude of natural origin |
8805 | Scale factor at natural origin |
8806 | False easting |
8807 | False northing |
createParameterDescriptor
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.DefaultParameterDescriptor
public OperationMethod createOperationMethod(String code) throws NoSuchAuthorityCodeException, FactoryException
OperationMethod
is a kind of metadata: it does not perform any coordinate operation
(e.g. map projection) by itself, but tells us what is needed in order to perform such operation.
Code | Description |
---|---|
9804 | Mercator (variant A) |
9802 | Lambert Conic Conformal (2SP) |
9810 | Polar Stereographic (variant A) |
9624 | Affine parametric transformation |
createOperationMethod
in interface CoordinateOperationAuthorityFactory
createOperationMethod
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.DefaultOperationMethod
,
Apache SIS™ Coordinate Operation Methodspublic CoordinateOperation createCoordinateOperation(String code) throws NoSuchAuthorityCodeException, FactoryException
Conversion
or a Transformation
, depending on the code.
Code | Description |
---|---|
1133 | ED50 to WGS 84 (1) |
1241 | NAD27 to NAD83 (1) |
1173 | NAD27 to WGS 84 (4) |
6326 | NAD83(2011) to NAVD88 height (1) |
createCoordinateOperation
in interface CoordinateOperationAuthorityFactory
createCoordinateOperation
in class GeodeticAuthorityFactory
code
- value allocated by EPSG.NoSuchAuthorityCodeException
- if the specified code
was not found.FactoryException
- if the object creation failed for some other reason.AbstractCoordinateOperation
public Set<CoordinateOperation> createFromCoordinateReferenceSystemCodes(String sourceCRS, String targetCRS) throws FactoryException
The returned set is ordered with the most accurate operations first.
Deprecated operations are not included in the set; if a deprecated operation is really wanted,
it can be fetched by an explicit call to createCoordinateOperation(String)
.
createFromCoordinateReferenceSystemCodes
in interface CoordinateOperationAuthorityFactory
createFromCoordinateReferenceSystemCodes
in class GeodeticAuthorityFactory
sourceCRS
- coded value of source coordinate reference system.targetCRS
- coded value of target coordinate reference system.sourceCRS
to targetCRS
.NoSuchAuthorityCodeException
- if a specified code was not found.FactoryException
- if the object creation failed for some other reason.public IdentifiedObjectFinder newIdentifiedObjectFinder() throws FactoryException
ID[…]
" or "AUTHORITY[…]
" element in Well Known Text.newIdentifiedObjectFinder
in class GeodeticAuthorityFactory
FactoryException
- if the finder can not be created.IdentifiedObjects.newFinder(String)
public void close() throws FactoryException
EPSGDataAccess
is used by an EPSGFactory
, then this method
will be automatically invoked after some timeout.close
in interface AutoCloseable
FactoryException
- if an error occurred while closing the connection.connection
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.