|
|||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
DataSource | A marker interface for data source to an EPSG database. |
Class Summary | |
AccessDataSource | Connection to the EPSG database in MS-Access format using JDBC-ODBC bridge. |
DefaultFactory | The default EPSG factory to be registered in FactoryFinder . |
FactoryUsingAnsiSQL | An EPSG factory for the database generated by SQL scripts rather than the MS-Access one. |
FactoryUsingOracleSQL | An EPSG factory suitable for Oracle SQL syntax. |
FactoryUsingSQL | Default implementation for a coordinate reference system factory backed by the EPSG database. |
FactoryUsingWKT | Implementation for a coordinate reference system authority factory backed by the EPSG property file. |
HSQLDataSource | Connection to the EPSG database in HSQL database engine format using JDBC. |
PostgreDataSource | Connection to the EPSG database in PostgreSQL database engine using JDBC. |
SimpleDataSource | Open a connection to an EPSG database using DriverManager . |
Authority factories for the EPSG database.
EPSG codes are numerical identifiers. For example "4326" is the EPSG identifier for the "WGS 84" geographic CRS. However, the default implementation accepts names as well as numeric identifiers. For example "NTF (Paris) / France I" and both fetchs the same object. Note that names may be ambiguous since the same name may be used for more than one object. This is the case of "WGS 84" for example. If such an ambiguity is found, an exception will be thrown.
An EPSG authority factory is created using the following code:
CRSAuthorityFactory factory =
FactoryFinder.getCRSAuthorityFactory("EPSG", null);
This package provides the general framework for accessing an EPSG database,
but the actual connection to a database requires the existence of an EPSG plugin in the classpath.
Otherwise, a FactoryNotFoundException
will be thrown. Available plugins are:
Required software | Data source | Plugin / JAR file | Additional notes |
---|---|---|---|
MS-Access ODBC driver | AccessDataSource |
See installation instructions | |
HSQL embedded database | HSQLDataSource |
Note for module mainteners | |
PostgreSQL database | PostgreDataSource |
Note for module mainteners |
For getting the EPSG factory to uses a custom connection, create some subclass
that implements Geotools's DataSource
interface. For
example:
import org.postgresql.ds.PGSimpleDataSource; import org.geotools.factory.Hints; import org.geotools.referencing.factory.AbstractAuthorityFactory; import org.geotools.referencing.factory.epsg.DataSource; public MyDataSource extends PGSimpleDataSource implements DataSource { public MyDataSource() { setServerName("myserver.com"); setDatabaseName("mydatabase"); } public int getPriority() { return MAXIMUM_PRIORITY - 200; public AbstractAuthorityFactory createFactory(Hints hints) throws SQLException { return new FactoryUsingAnsiSQL(hints, getConnection()); } }
Then, declare this custom implementation in the following file
(for uses by FactoryRegistry
):
META-INF/services/org.geotools.referencing.factory.epsg.DataSource
Just providing a JAR file with the above-cited DataSource
implementation and registration is suffisient for an application to connects automatically to
the specified server (providing that the relevant JDBC driver is present, of course).
Installation on Unix systems typically has a database software running on some
server rather than the local machine. The administrator will probably have to download the SQL
scripts from http://www.epsg.org and executes it in whatever database
software they use (PostgreSQL, MySQL, Oracle, etc.). The connection parameters (server URL,
user name, etc.) can be specified as a DataSource
registered with a naming service based on Java Naming and Directory (JNDI) interfaces. Like databases, the
naming service is typically located on some server. The data source name for the connection to the EPSG database
is {@value}
.
For setting up a naming service (LDAP, NIS, etc.), see the JNDI tutorial.
For an example of DataSource
creation with different connection parameters
than the default ones, see New data source
implementations in the JDBC-ODBC bridge.
For DataSource
implementations targeting other database softwares, see
their JDBC documentation. For example the PostgreSQL JDBC provides
an basic implementation.
|
|||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |