| java.lang.Object org.geotools.demo.referencing.CTSTutorial
CTSTutorial | public class CTSTutorial (Code) | | Code for the geotools coordinate transformation services tutorial:
http://docs.codehaus.org/display/GEOTOOLS/Coordinate+Transformation+Services+for+Geotools+2.1
The following code is made up of many, short methods used for discussion in the tutorial,
and does not create a coherent program.
These examples cover the following topics:
- creating coordinate reference systems (CRS) by hand
- creating CRS's from well known text (WKT) strings
- creating CRS's from authority codes
- creating math transforms between CRS's
- creating math transforms by hand
-
START SNIPPET and END SNIPPET comments are used by the wiki to display code snippets from svn.
Factory creation is repeated below so that it shows up in the tutorial code snippets.
version: $Id: CTSTutorial.java 21780 2006-10-03 21:06:21Z desruisseaux $ author: Rueben Schulz author: TODO using the auto crs factory |
CTSTutorial | CTSTutorial()(Code) | | |
creatCRSFromWKT | void creatCRSFromWKT() throws Exception(Code) | | An example of creating a CRS from a WKT string. Additonal examples of WKT strings
can be found in
http://svn.geotools.org/geotools/trunk/gt/module/referencing/test/org/geotools/referencing/test-data/
TODO Brief description of what a CRS is (and what it is composed of)
throws: Exception - |
createAndUseMathTransform | void createAndUseMathTransform() throws FactoryException, MismatchedDimensionException, TransformException(Code) | | Creates a low level math transform by hand. This is essentially just an equation (with some parameters)
used to transform input to output points.
throws: TransformException - throws: MismatchedDimensionException - |
createCRSByHand1 | void createCRSByHand1() throws Exception(Code) | | Creates a WGS 84/UTM Zone 10N CRS mostly (uses some premade objects) by
hand. Uses the higher level FactoryGroup instead of the lower level
MathTransformFactory (commented out).
throws: Exception - |
createCRSByHand2 | void createCRSByHand2() throws Exception(Code) | | Creates a NAD 27 geographic CRS. Notice that the datum factory
automatically adds aliase names to the datum (because "North American
Datum 1927" has an entry in
http://svn.geotools.org/geotools/trunk/gt/module/referencing/src/org/geotools/referencing/factory/DatumAliasesTable.txt ).
Also notice that toWGS84 information (used in a datum transform) was
also added to the datum.
|
createCRSByHand3 | void createCRSByHand3() throws FactoryException(Code) | | Creates two coordinate reference system by hand without using any of the
GT2 APIs (except FactoryFinder to get things started). It does not use
any of the static objects available in geotools implementations. The
following example creates a CRS to represent the Airy 1830 ellipsoid with
the incoming data in the order of (long,lat,height) and a geocentric CRS
with (x,y,z) axises.
TODO the Airy CRS described below is actually wgs84, FIX this.
throws: FactoryException - |
createFromEPSGCode | void createFromEPSGCode() throws Exception(Code) | | Creates a CRS from an EPSG code. There are a few different EPSG authority
factories in geotools that do roughly the same thing:
- gt2-epsg-access.jar is backed by the official EPSG MS Access
database (only works on MS Windows, therefore I have not shown how to
configure it here).
- gt2-epsg-hsql.jar provides an embeded hsql database created from the
EPSG SQL scripts. This contains the same information as the MS Arcess
database.
- other factories allow the EPSG information to be in an external
database (postgresql, mysql, oracle)
- gt2-epsg-wkt.jar is a simple properties file with WKT descriptions
for EPSG defined CRS codes. This file does not derive directly from the
official EPSG database, so its should be used with caution. It provides a
very simple method of creating a new authority factory and named objects.
The specific authority factory returned by getCRSAuthorityFactory is
dependent on the different factories on your classpath (ie WKT or Access
or HSQL) and the hints you provide. By default the "better" authority
factory should be used if more than one is available.
TODO check on the use of hints
TODO expand on how to use EPSG data in a
postgres db (this may be a 2.2 feature, but FactoryUsingANSISQL may work)
|
createMathTransformBetweenCRSs | void createMathTransformBetweenCRSs() throws Exception(Code) | | Creates a math transform between the CRS's created in createCRSByHand2()
and createCRSByHand1(). The resulting transformation is a concatenation
of the following transforms:
- Affine - to switch axis order from (latitude,longitude) to (longitude,latitude)
- Molodenski - to preform a datum shift between NAD27 and WGS84,
using the NAD 27 CRS BursaWolfParameters parameters
- Transverse Mercator - to convert from geographic to projected UTM coordinates
throws: Exception - |
createOperationFromAuthorityCode | void createOperationFromAuthorityCode() throws Exception(Code) | | since: 2.2 throws: Exception - |
createTransformFromAuthorityCode | void createTransformFromAuthorityCode() throws Exception(Code) | | since: 2.2 throws: Exception - |
premadeObjects | void premadeObjects()(Code) | | A method with some examples of premade static objects.
|
printIdentifierStuff | void printIdentifierStuff(IdentifiedObject identObj)(Code) | | Print out information about an identified object
|
transformUsingCRSUtility | void transformUsingCRSUtility() throws Exception(Code) | | Uses the CRS utility class to create two CRSs and a tranformation between them.
|
|
|