|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAuthorityFactoryProvider
public class AuthorityFactoryProvider
Convenience class for creating CRSAuthorityFactory instances using custom CRS definitions.
Most methods in this class expect the Coordinate Reference
System (CRS) definitions to be provided in
Well
Known Text (WKT) form, since this is often the easiest way to define custom CRS.
The following example creates a factory for ESRI codes. The CRS are defined in a
properties file in the same directory than the
class invoking the method (replace MyClass by the name of your class):
URL definitionURL = MyClass.class.getResource("myfile.properties");
AuthorityFactoryProvider provider = new AuthorityFactoryProvider();
CRSAuthorityFactory factory = provider.createFromProperties(Citations.ESRI, definitionURL);
The following example creates a factory which use the definitions provided in the
"spatial_ref_sys" table
of a PostGIS database:
final PGSimpleDataSource ds = new PGSimpleDataSource();
ds.setServerName("myServer");
ds.setDatabaseName("myDatabase");
ds.setUser("myUsername");
ds.setPassword("myPassword");
AuthorityFactoryProvider provider = new AuthorityFactoryProvider();
CRSAuthorityFactory factory = provider.createFromPostGIS(ds);
| referencing/geotk-referencing (download) | View source code for this class |
| Constructor Summary | |
|---|---|
AuthorityFactoryProvider()
Creates a new instance which will use the default hints. |
|
AuthorityFactoryProvider(Hints hints)
Creates a new instance which will use the given hints. |
|
| Method Summary | |
|---|---|
CRSAuthorityFactory |
createFromPostGIS(DataSource datasource)
Creates a factory for the specified PostGIS database. |
CRSAuthorityFactory |
createFromProperties(Citation authority,
URL definitionFile)
Creates a factory for the specified authority using the definitions declared in the given properties file. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AuthorityFactoryProvider()
public AuthorityFactoryProvider(Hints hints)
hints - The user hints, or null if none.| Method Detail |
|---|
public CRSAuthorityFactory createFromProperties(Citation authority,
URL definitionFile)
throws FactoryException
URL, which is typically obtained by invoking Class.getResource(String).
authority - The organization or party responsible for CRS definition.definitionFile - URL to the definition file.
FactoryException - If the authority factory can not be created, typically because
the given definition file was not found.
public CRSAuthorityFactory createFromPostGIS(DataSource datasource)
throws FactoryException
Disposable interface. Invoking its
dispose() method closes any JDBC connection which may be open.
datasource - Provides connection to the PostGIS database.
FactoryException - If the authority factory can not be created.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||