Frédéric LIGEARD a écrit :
Is there any example of code with transform from one system to other
with the new API ?
Make sure that the following JAR appears in the class-path:
geoapi.jar; gt2-referencing.jar; gt2-epsg-hsql.jar; hsqldb.jar; vecmath.jar
Note: if all JARs are in the same directory and if you use the JAR from
the Maven 2 build (e.g. the *2.2-RC0.jar file), then the following
should be enough:
java -classpath gt2-epsg-hsql.jar ...
All other dependencies are specified in the META-INF file provided with
each gt2-*-2.2-RC0.jar file.
import org.opengis.referencing.*;
import org.opengis.referencing.crs.*;
import org.opengis.referencing.operation.*;
import org.geotools.referencing.FactoryFinder;
CRSAuthorityFactory crsFactory =
FactoryFinder.getCRSAuthorityFactory("EPSG", null);
CoordinateReferenceSystem sourceCRS =
crsFactory.createCoordinateReferenceSystem("EPSG:4326");
CoordinateReferenceSystem targetCRS =
crsFactory.createCoordinateReferenceSystem("EPSG:put-lambert-II-code-here");
CoordinateOperationFactory opFactory =
FactoryFinder.getCoordinateOperationFactory(null);
CoordinateOperation operation =
opFactory.createCoordinateOperation(sourceCRS, targetCRS);
MathTransform mt = operation.getMathTransform();
DirectPosition sourcePt = new GeneralDirectPosition(...);
DirectPosition targetPt = mt.transform(sourcePt, null);
Martin.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users