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

Jon Blower j.d.blower at reading.ac.uk
Tue Oct 13 14:54:08 EDT 2009

Thanks Martin, that looks perfect.  If this method:

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

is reliable, then would it be possible to add a related method
CRS.isHorizontalCRS()?  I guess internally this would use the above
idiom but would be a useful convenience method for clients.

Cheers, Jon

On Tue, Oct 13, 2009 at 4:53 PM, Martin Desruisseaux
<martin.desruisseaux at geomatys.fr> wrote:
> 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:
> http://www.geotoolkit.org/apidocs/org/geotoolkit/referencing/CRS.html#getHorizontalCRS%28org.opengis.referencing.crs.CoordinateReferenceSystem%29
> So in the 2D case, the following idiom should evaluate to "true" if the CRS
> is horizontal:
>  if (crs == CRS.getHorizontalCRS(crs)) {
>      // Horizontal case
>  }
>        Martin

Dr Jon Blower
Technical Director, Reading e-Science Centre
Environmental Systems Science Centre
University of Reading
Harry Pitt Building, 3 Earley Gate
Reading RG6 6AL. UK
Tel: +44 (0)118 378 5213
Fax: +44 (0)118 378 6413
j.d.blower at reading.ac.uk

More information about the Geotoolkit mailing list