|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.cs.CoordinateSystemAuthorityFactory
org.geotools.cs.CoordinateSystemEPSGFactory
FactoryUsingSQL
.
Default implementation for a coordinate system factory backed
by the EPSG database. The EPSG database is freely available at
http://www.epsg.org. Current
version of this class requires EPSG database version 6.
EPSG_v6.mdb
file can be stored anywhere on your system under
any name, at your convenience. The database must be declared as an ODBC data source. Steps
to follow:
40?30'N
would be coded as 40.30
(sexagesimal degree) instead of 40.5
(fractional degree). Unfortunatly,
sexagesimal degrees have the following inconvenients:
AngleFormat
.CoordinateSystemEPSGFactory
will
not use sexagesimal degrees for coordinate systems. All axis will use
fractional degrees instead, which are way more convenient for computation purpose (radians
would be as good). If sexagesimal degrees are really wanted, subclasses should overrides
the replaceAxisUnit(org.geotools.units.Unit)
method.
Field Summary | |
protected java.sql.Connection |
connection
Deprecated. The connection to the EPSG database. |
Fields inherited from class org.geotools.cs.CoordinateSystemAuthorityFactory |
factory |
Constructor Summary | |
CoordinateSystemEPSGFactory(CoordinateSystemFactory factory,
java.sql.Connection connection)
Deprecated. Construct an authority factory using the specified connection. |
|
CoordinateSystemEPSGFactory(CoordinateSystemFactory factory,
java.lang.String url,
java.lang.String driver)
Deprecated. Construct an authority factory using the specified URL to an EPSG database. |
Method Summary | |
protected java.lang.String |
adaptSQL(java.lang.String statement)
Deprecated. Invoked when a new PreparedStatement is about to be created from a SQL string.
|
CompoundCoordinateSystem |
createCompoundCoordinateSystem(java.lang.String code)
Deprecated. Create a compound coordinate system from the EPSG code. |
CoordinateSystem |
createCoordinateSystem(java.lang.String code)
Deprecated. Returns a coordinate system from a code. |
Datum |
createDatum(java.lang.String code)
Deprecated. Returns a datum from a code. |
Ellipsoid |
createEllipsoid(java.lang.String code)
Deprecated. Returns an Ellipsoid object from a code. |
GeographicCoordinateSystem |
createGeographicCoordinateSystem(java.lang.String code)
Deprecated. Returns a geographic coordinate system from an EPSG code. |
java.lang.Object |
createObject(java.lang.String code)
Deprecated. Returns an arbitrary object from a code. |
PrimeMeridian |
createPrimeMeridian(java.lang.String code)
Deprecated. Returns a prime meridian, relative to Greenwich. |
ProjectedCoordinateSystem |
createProjectedCoordinateSystem(java.lang.String code)
Deprecated. Returns a projected coordinate system from an EPSG code. |
Unit |
createUnit(java.lang.String code)
Deprecated. Returns a Unit object from a code. |
VerticalCoordinateSystem |
createVerticalCoordinateSystem(java.lang.String code)
Deprecated. Returns a vertical coordinate system from an EPSG code. |
void |
dispose()
Deprecated. Dispose any resources hold by this object. |
java.lang.String |
getAuthority()
Deprecated. Returns the authority name, which is "EPSG" . |
static CoordinateSystemAuthorityFactory |
getDefault()
Deprecated. Returns a default coordinate system factory backed by the EPSG database. |
static void |
main(java.lang.String[] args)
Deprecated. Construct an object from the EPSG database and print its WKT (Well Know Text) to the standard output. |
protected Unit |
replaceAxisUnit(Unit unit)
Deprecated. Replace the axis's unit for a coordinate system. |
Methods inherited from class org.geotools.cs.CoordinateSystemAuthorityFactory |
createHorizontalCoordinateSystem, createHorizontalDatum, createVerticalDatum |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final java.sql.Connection connection
Constructor Detail |
public CoordinateSystemEPSGFactory(CoordinateSystemFactory factory, java.sql.Connection connection)
factory
- The underlying factory used for objects creation.connection
- The connection to the underlying EPSG database.public CoordinateSystemEPSGFactory(CoordinateSystemFactory factory, java.lang.String url, java.lang.String driver) throws java.sql.SQLException
factory
- The underlying factory used for objects creation.url
- The url to the EPSG database. For example, a connection
using the ODBC-JDBC bridge may have an URL likes
"jdbc:odbc:EPSG"
.driver
- An optional driver to load, or null
if none.
This is a convenience argument for the following pseudo-code:
Class.forName(driver).newInstance();
A message is logged to "org.geotools.cts"
wether
the loading sucseeds of fails. For JDBC-ODBC bridge, a typical value
for this argument is "sun.jdbc.odbc.JdbcOdbcDriver"
.
This argument needs to be non-null only once for a specific driver.
java.sql.SQLException
- if the constructor failed to connect to the EPSG database.Method Detail |
public static CoordinateSystemAuthorityFactory getDefault() throws java.sql.SQLException
dispose()
on this special factory will not close the database
connection, since it may be shared by many users. However, it is safe to invoke
dispose()
anyway in order to release some resources used by this instance.
"sun.jdbc.odbc.JdbcOdbcDriver"
and
ask for a connection to the "jdbc:odbc:EPSG"
database. This default
behavior can be changed by invoking the main(java.lang.String[])
method from the command line.
For example:
java org.geotools.cs.CoordinateSystemEPSGFactory -driver=[my driver] -connection=[my url]
java.sql.SQLException
- if the connection to the database can't be etablished.protected java.lang.String adaptSQL(java.lang.String statement)
PreparedStatement
is about to be created from a SQL string.
Since the EPSG database is available only in MS-Access
format, SQL statements are formatted using some syntax specific to this particular database
software (for example "SELECT * FROM [Coordinate Reference System]
").
If a port of EPSG database is to be used with an other software, then this method should be
overriden in order to adapt the SQL syntax. For example a subclass connecting to a
PostgreSQL database could replace all spaces (" ") between
watching braces ("[" and "]") by underscore ("_").
statement
- The statement in MS-Access syntax.
public java.lang.String getAuthority()
"EPSG"
.
getAuthority
in class CoordinateSystemAuthorityFactory
public java.lang.Object createObject(java.lang.String code) throws org.opengis.referencing.FactoryException
createCoordinateSystem(java.lang.String)
,
createDatum(java.lang.String)
, createEllipsoid(java.lang.String)
, or createUnit(java.lang.String)
methods according the object type.
createObject
in class CoordinateSystemAuthorityFactory
code
- The EPSG value.
NoSuchAuthorityCodeException
- if this method can't find the requested code.
org.opengis.referencing.FactoryException
- if some other kind of failure occured in the backing
store. This exception usually have SQLException
as its cause.CoordinateSystemAuthorityFactory.createCoordinateSystem(java.lang.String)
,
CoordinateSystemAuthorityFactory.createDatum(java.lang.String)
,
CoordinateSystemAuthorityFactory.createEllipsoid(java.lang.String)
,
CoordinateSystemAuthorityFactory.createUnit(java.lang.String)
public Ellipsoid createEllipsoid(java.lang.String code) throws org.opengis.referencing.FactoryException
Ellipsoid
object from a code.
createEllipsoid
in class CoordinateSystemAuthorityFactory
code
- The EPSG value.
NoSuchAuthorityCodeException
- if this method can't find the requested code.
org.opengis.referencing.FactoryException
- if some other kind of failure occured in the backing
store. This exception usually have SQLException
as its cause.CS_CoordinateSystemAuthorityFactory.createEllipsoid(java.lang.String)
public Unit createUnit(java.lang.String code) throws org.opengis.referencing.FactoryException
Unit
object from a code.
createUnit
in class CoordinateSystemAuthorityFactory
code
- Value allocated by authority.
NoSuchAuthorityCodeException
- if this method can't find the requested code.
org.opengis.referencing.FactoryException
- if some other kind of failure occured in the backing
store. This exception usually have SQLException
as its cause.CS_CoordinateSystemAuthorityFactory.createLinearUnit(java.lang.String)
,
CS_CoordinateSystemAuthorityFactory.createAngularUnit(java.lang.String)
public PrimeMeridian createPrimeMeridian(java.lang.String code) throws org.opengis.referencing.FactoryException
createPrimeMeridian
in class CoordinateSystemAuthorityFactory
code
- Value allocated by authority.
NoSuchAuthorityCodeException
- if this method can't find the requested code.
org.opengis.referencing.FactoryException
- if some other kind of failure occured in the backing
store. This exception usually have SQLException
as its cause.CS_CoordinateSystemAuthorityFactory.createPrimeMeridian(java.lang.String)
public Datum createDatum(java.lang.String code) throws org.opengis.referencing.FactoryException
createDatum
in class CoordinateSystemAuthorityFactory
code
- Value allocated by authority.
NoSuchAuthorityCodeException
- if this method can't find the requested code.
org.opengis.referencing.FactoryException
- if some other kind of failure occured in the backing
store. This exception usually have SQLException
as its cause.CoordinateSystemAuthorityFactory.createHorizontalDatum(java.lang.String)
,
CoordinateSystemAuthorityFactory.createVerticalDatum(java.lang.String)
DatumType.ELLIPSOIDAL
and all "horizontal"
datum to DatumType.GEOCENTRIC
. At the time
of writting, it was not clear how to maps the exact
datum type from the EPSG database., REVISIT: The creation of horizontal datum use only the first
WGS84ConversionInfo
object, because current
version of CoordinateSystemFactory
do not
allows more than one conversion info. We should fix
that., TODO: Datum "engineering" is currently not supported.public CoordinateSystem createCoordinateSystem(java.lang.String code) throws org.opengis.referencing.FactoryException
createCoordinateSystem
in class CoordinateSystemAuthorityFactory
code
- Value allocated by authority.
NoSuchAuthorityCodeException
- if this method can't find the requested code.
org.opengis.referencing.FactoryException
- if some other kind of failure occured in the backing
store. This exception usually have SQLException
as its cause.CoordinateSystemAuthorityFactory.createHorizontalCoordinateSystem(java.lang.String)
,
CoordinateSystemAuthorityFactory.createGeographicCoordinateSystem(java.lang.String)
,
CoordinateSystemAuthorityFactory.createProjectedCoordinateSystem(java.lang.String)
,
CoordinateSystemAuthorityFactory.createVerticalCoordinateSystem(java.lang.String)
,
CoordinateSystemAuthorityFactory.createCompoundCoordinateSystem(java.lang.String)
public GeographicCoordinateSystem createGeographicCoordinateSystem(java.lang.String code) throws org.opengis.referencing.FactoryException
createGeographicCoordinateSystem
in class CoordinateSystemAuthorityFactory
code
- Value allocated by authority.
NoSuchAuthorityCodeException
- if this method can't find the requested code.
org.opengis.referencing.FactoryException
- if some other kind of failure occured in the backing
store. This exception usually have SQLException
as its cause.CS_CoordinateSystemAuthorityFactory.createGeographicCoordinateSystem(java.lang.String)
public ProjectedCoordinateSystem createProjectedCoordinateSystem(java.lang.String code) throws org.opengis.referencing.FactoryException
createProjectedCoordinateSystem
in class CoordinateSystemAuthorityFactory
code
- Value allocated by authority.
NoSuchAuthorityCodeException
- if this method can't find the requested code.
org.opengis.referencing.FactoryException
- if some other kind of failure occured in the backing
store. This exception usually have SQLException
as its cause.CS_CoordinateSystemAuthorityFactory.createProjectedCoordinateSystem(java.lang.String)
public VerticalCoordinateSystem createVerticalCoordinateSystem(java.lang.String code) throws org.opengis.referencing.FactoryException
createVerticalCoordinateSystem
in class CoordinateSystemAuthorityFactory
code
- Value allocated by authority.
NoSuchAuthorityCodeException
- if this method can't find the requested code.
org.opengis.referencing.FactoryException
- if some other kind of failure occured in the backing
store. This exception usually have SQLException
as its cause.CS_CoordinateSystemAuthorityFactory.createVerticalCoordinateSystem(java.lang.String)
public CompoundCoordinateSystem createCompoundCoordinateSystem(java.lang.String code) throws org.opengis.referencing.FactoryException
createCompoundCoordinateSystem
in class CoordinateSystemAuthorityFactory
code
- the EPSG code for the CS.
NoSuchAuthorityCodeException
- if this method can't find the requested code.
org.opengis.referencing.FactoryException
- if some other kind of failure occured in the backing
store. This exception usually have SQLException
as its cause.CS_CoordinateSystemAuthorityFactory.createCompoundCoordinateSystem(java.lang.String)
protected Unit replaceAxisUnit(Unit unit)
create...CoordinateSystem
methods, but not by other methods like
createPrimeMeridian
. The default implementation replace sexagesimal
degree units by the plain fractional degree units, which is much more suitable
to computations (see Note about multi-radix units in this class's
description).
unit
with no change.
unit
- The unit declared in the EPSG database for a coordinate system.
unit
with no change, or a substitute
if unit
was a multi-radix unit (e.g. sexagesimal degree).public void dispose() throws org.opengis.referencing.FactoryException
getDefault()
.
dispose
in class CoordinateSystemAuthorityFactory
org.opengis.referencing.FactoryException
- if an error occured while closing the connection.public static void main(java.lang.String[] args)
Should print:java org.geotools.cs.CoordinateSystemEPSGFactory 4181
The following optional arguments are supported:GEOGCS["Luxembourg 1930", DATUM["Luxembourg 1930", etc...
-connection
Set the EPSG database URL. The URL must conform toDriverManager.getConnection(String)
specification. The default value isjdbc:odbc:EPSG
. The specified URL is stored in system preferences and will become the default URL for every calls togetDefault()
. The "default
" string reset the default URL.
-driver
Set the driver class. The default value issun.jdbc.odbc.JdbcOdbcDriver
. The specified classname is stored in system preferences and will become the default driver for every calls togetDefault()
. The "default
" string reset the default driver.
-implementation
Set an alternative implementation. The argument must be a fully qualified class name of aCoordinateSystemEPSGFactory
subclass. The implementation must have a public constructor with the following arguments:The specified classname is stored in system preferences and will become the default implementation for every calls to
- The coordinate system factory as a
CoordinateSystemFactory
- The EPSG database URL as a
String
- The database driver as a
String
getDefault()
. The "default
" string reset the default implementation.
-encoding
Set the console encoding for this application output. This value has no impact onCoordinateSystemEPSGFactory
behavior.
args
- A list of EPSG code to display.
An arbitrary number of code can be specified on the command line.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |