[geotk] Identifying projection types on CRS

Aaron Braeckel braeckel at ucar.edu
Mon Apr 25 22:42:00 EDT 2011


Hello,

I'd like to be able to programmatically detect certain ProjectedCRS
types, such as LambertConformal and Mercator.  Here is the code I was
hoping to use:

CoordinateReferenceSystem crs = ...;
CoordinateReferenceSystem horizCrs = CRS.getHorizontalCRS( crs );
//magic occurs
if( myOperationMethod instanceof AlbersEqualArea ){
   //do something extraordinarily amazing
}

I have yet to find a clear way to do something like this.  When I
receive ProjectedCRSs I have yet to find any classes from the
org.geotoolkit.referencing.operation.projection package anywhere, just
general-purpose instances.  In digging around it seems as if there are
multiple paths that could be taken to try to identify the
operationMethod/mathTransform/etc.

   1. Use identifiers (EPSG:9807, for example).  Not sure where in the
      Geotk hierarchy of instances would be best to do so
   2. Instantiate an instance of a projected type
      (AlbersEqualArea.class) and use one of the weak .equals() calls
   3. Get an instance of a projected type (AlbersEqualArea.class) from
      the horizontal CRS somehow

Any thoughts?

Thanks,
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geotoolkit/attachments/20110425/62274508/attachment.html


More information about the Geotoolkit mailing list