Sunburned Surveyor a écrit :
> I'd like to share some thoughts on the referencing module. I'm
> wondering if this new situation that has developed would be an
> opportunity to introduce a common interface that could be used for
> coordinate transformations.

Those interfaces already exist in GeoAPI. This is the MathTransform interface:

http://geoapi.sourceforge.net/snapshot/javadoc/org/opengis/referencing/operation/MathTransform.html

This interface is derived from OGC 01-009 specification (OpenGIS Coordinate
Transformation Service Implementation Specification):

http://www.opengeospatial.org/standards/ct



> public abstract void setSourceCrs(String argSourceCrs);
> 
> public abstract void setDestinationCrs(String argDestinationCrs);
> 
> public abstract double[] transformCoordinate(double[] coordinate);


Using GeoAPI interfaces (all derived from OGC specifications, let me remind),
you would process as below:

CoordinateReferenceSystem sourceCRS = crsFactory.createFromWKT("...");
CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT("...");
MathTransform mt = coordinateOperationFactory.createOperation(sourceCRS,
targetCRS).getMathTransform():
mt.transform(coordinates, 0, coordinates, 0, numPoints);

If it is too verbose, a trivial helper class could be created with the above
API. But it would be just a convenience class delegating the work to the 4 above
lines.

        Martin

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to