[geotk] Easy way to detect a horizontal 2D CRS?

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Tue Oct 13 11:53:42 EDT 2009

Jon Blower a écrit :
> Is there an easy way to determine, for example, that a
> CoordinateReferenceSystem object represents a 2D horizontal CRS?  I
> would guess that most of the 2D CRSs are currently horizontal, but one
> could imagine an x-z coordinate system that would not be.

In the 2D case, I use the following criterion: The CRS is considered horizontal 
if it is either an instance of GeographicCRS, or a CRS derived from 
GeographicCRS (this include the ProjectedCRS case). The 3D case is a little bit 
more difficult; for now I rely on axis directions, which is not really 
future-proof as you point out.

An easy way to make this check is to use the following convenience method:


So in the 2D case, the following idiom should evaluate to "true" if the CRS is 

   if (crs == CRS.getHorizontalCRS(crs)) {
       // Horizontal case


More information about the Geotoolkit mailing list