org.gcube.dataanalysis.geo.utils
Class CrsHelper

java.lang.Object
  extended by org.gcube.dataanalysis.geo.utils.CrsHelper

public final class CrsHelper
extends Object

This class wraps the GeoTools/GeoAPI coordinate reference system methods, providing a set of convenience methods such as transformations and validity checks.

Author:
Jon

Field Summary
static String PLATE_CARREE_CRS_CODE
           
static List<String> SUPPORTED_CRS_CODES
           
 
Method Summary
 ucar.unidata.geoloc.LatLonPoint crsToLatLon(double x, double y)
          Transforms the given x-y point in this CRS to a LatLonPoint.
 ucar.unidata.geoloc.LatLonPoint crsToLatLon(ucar.unidata.geoloc.ProjectionPoint point)
          Transforms the given x-y point in this CRS to a LatLonPoint.
static CrsHelper fromCrsCode(String crsCode)
           
 org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
           
 boolean isLatLon()
           
 boolean isPointValidForCrs(double x, double y)
           
 boolean isPointValidForCrs(ucar.unidata.geoloc.ProjectionPoint point)
           
 ucar.unidata.geoloc.ProjectionPoint latLonToCrs(double longitude, double latitude)
          Transforms the given longitude-latitude point to an x-y point in this CRS.
 ucar.unidata.geoloc.ProjectionPoint latLonToCrs(ucar.unidata.geoloc.LatLonPoint latLonPoint)
          Transforms the given LatLonPoint to an x-y point in this CRS.
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLATE_CARREE_CRS_CODE

public static final String PLATE_CARREE_CRS_CODE
See Also:
Constant Field Values

SUPPORTED_CRS_CODES

public static final List<String> SUPPORTED_CRS_CODES
Method Detail

fromCrsCode

public static CrsHelper fromCrsCode(String crsCode)
                             throws Exception
Throws:
Exception

getCoordinateReferenceSystem

public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()

isPointValidForCrs

public boolean isPointValidForCrs(ucar.unidata.geoloc.ProjectionPoint point)
Returns:
true if the given coordinate pair is within the valid range of both the x and y axis of this coordinate reference system.

isPointValidForCrs

public boolean isPointValidForCrs(double x,
                                  double y)
Returns:
true if the given coordinate pair is within the valid range of both the x and y axis of this coordinate reference system.

crsToLatLon

public ucar.unidata.geoloc.LatLonPoint crsToLatLon(double x,
                                                   double y)
                                            throws org.opengis.referencing.operation.TransformException
Transforms the given x-y point in this CRS to a LatLonPoint.

Throws:
org.opengis.referencing.operation.TransformException - if the required transformation could not be performed

crsToLatLon

public ucar.unidata.geoloc.LatLonPoint crsToLatLon(ucar.unidata.geoloc.ProjectionPoint point)
                                            throws org.opengis.referencing.operation.TransformException
Transforms the given x-y point in this CRS to a LatLonPoint.

Throws:
org.opengis.referencing.operation.TransformException - if the required transformation could not be performed

latLonToCrs

public ucar.unidata.geoloc.ProjectionPoint latLonToCrs(ucar.unidata.geoloc.LatLonPoint latLonPoint)
                                                throws org.opengis.referencing.operation.TransformException
Transforms the given LatLonPoint to an x-y point in this CRS.

Throws:
org.opengis.referencing.operation.TransformException - if the required transformation could not be performed

latLonToCrs

public ucar.unidata.geoloc.ProjectionPoint latLonToCrs(double longitude,
                                                       double latitude)
                                                throws org.opengis.referencing.operation.TransformException
Transforms the given longitude-latitude point to an x-y point in this CRS.

Throws:
org.opengis.referencing.operation.TransformException - if the required transformation could not be performed

isLatLon

public boolean isLatLon()
Returns:
true if this crs is lat-lon

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2013. All Rights Reserved.