es.prodevelop.geodetic.utils.conversion
Class GeoUtils

java.lang.Object
  extended byes.prodevelop.geodetic.utils.conversion.GeoUtils

public class GeoUtils
extends java.lang.Object

Some utility functions for converdion purposes.

Author:
vsanjaime, jldominguez
See Also:
Elipsoide

Field Summary
static java.lang.String[] CRS_CODE_KNOWN
          Known projection IDs: Geo WGS84, Geo ED50 + UTM - ED50 - zone 27N - 39N + UTM - WGS84 - zone 1N - 60N + UTM - WGS84 - zone 1S - 60S
static double Degree
          Useful constants
static double HalfPi
          Useful constants
static double SQ_METERS_LIMIT
          Useful constants
static double SqKm
          Useful constants
static double SqM
          Useful constants
static double SqMi
          Useful constants
 
Constructor Summary
GeoUtils()
           
 
Method Summary
static double distance(double x1, double y1, double x2, double y2)
          Gets the Euclidean distance between points A and B.
static double getAreaInSquareMeters(java.awt.geom.PathIterator pit, java.lang.String _srs)
          Gets the area in square meters of the given path iterator, given its SRS
static double[] getIteratorLengthAndLast(java.awt.geom.PathIterator piter)
          Gets the length of the path iterator and of the last of its arcs.
static double[] getIteratorLengthAndLast(java.awt.geom.PathIterator pit, java.lang.String _srs)
          Gets the length in meters of a path iterator and the length of the last of its arcs, given the SRS
static double getScale(Projection p, double distance_in_proj_units, double distance_in_map_in_meters)
          This method computes the scale of a map.
static int getZone(IProjection p)
          Utility method to get the zone of a UTM projection.
static java.lang.String inTwoDigits(int n)
           
static boolean isInED50Meters(IProjection p)
          Utility method to find out if the given projection is in meters and in ED50.
static boolean isInWGS84Meters(IProjection p)
          Utility method to find out if the given projection is in meters and in ED50.
static boolean isLatLonProjection(java.lang.String abbrev)
           
static double sphericalAreaFromCoordinatesArray(com.vividsolutions.jts.geom.Coordinate[] cc)
          Utility method to find out the spherical area of the polygon described with an array of coordinates
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQ_METERS_LIMIT

public static final double SQ_METERS_LIMIT
Useful constants

See Also:
Constant Field Values

HalfPi

public static double HalfPi
Useful constants


Degree

public static double Degree
Useful constants


SqMi

public static double SqMi
Useful constants


SqKm

public static double SqKm
Useful constants


SqM

public static double SqM
Useful constants


CRS_CODE_KNOWN

public static java.lang.String[] CRS_CODE_KNOWN
Known projection IDs: Geo WGS84, Geo ED50 + UTM - ED50 - zone 27N - 39N + UTM - WGS84 - zone 1N - 60N + UTM - WGS84 - zone 1S - 60S

Constructor Detail

GeoUtils

public GeoUtils()
Method Detail

isInED50Meters

public static boolean isInED50Meters(IProjection p)
Utility method to find out if the given projection is in meters and in ED50.

Parameters:
p - the projection of interest
Returns:
whether the given projection is in meters and in ED50.

isInWGS84Meters

public static boolean isInWGS84Meters(IProjection p)
Utility method to find out if the given projection is in meters and in ED50.

Parameters:
p - the projection of interest
Returns:
whether the given projection is in meters and in ED50.

getZone

public static int getZone(IProjection p)
Utility method to get the zone of a UTM projection.

Parameters:
p - The projection of interest
Returns:
the zone of the UTM projection, or -1 if it's not a known UTM projection

getAreaInSquareMeters

public static double getAreaInSquareMeters(java.awt.geom.PathIterator pit,
                                           java.lang.String _srs)
Gets the area in square meters of the given path iterator, given its SRS

Parameters:
pit - the path iterator of interest
_srs - the SRS of the coordinates
Returns:
the area in square meters of the given path iterator

getIteratorLengthAndLast

public static double[] getIteratorLengthAndLast(java.awt.geom.PathIterator pit,
                                                java.lang.String _srs)
Gets the length in meters of a path iterator and the length of the last of its arcs, given the SRS

Parameters:
pit - the path iterator of interest
_srs - the SRS
Returns:
an arrau with the length in meters of a path iterator and the length of the last of its arcs

sphericalAreaFromCoordinatesArray

public static double sphericalAreaFromCoordinatesArray(com.vividsolutions.jts.geom.Coordinate[] cc)
Utility method to find out the spherical area of the polygon described with an array of coordinates

Parameters:
cc - array of coordinates describing the spherical polygon of interest
Returns:
the spherical area in square degrees

distance

public static double distance(double x1,
                              double y1,
                              double x2,
                              double y2)
Gets the Euclidean distance between points A and B.

Parameters:
x1 - x coordinate of point A
y1 - y coordinate of point A
x2 - x coordinate of point B
y2 - y coordinate of point B
Returns:
the Euclidean distance between points A and B.

getIteratorLengthAndLast

public static double[] getIteratorLengthAndLast(java.awt.geom.PathIterator piter)
Gets the length of the path iterator and of the last of its arcs. No SRS or unit conversion is used, just the plain length between coordinates.

Parameters:
piter - the path iterator of interest
Returns:
the length of the path iterator and of the last of its arcs.

getScale

public static double getScale(Projection p,
                              double distance_in_proj_units,
                              double distance_in_map_in_meters)
This method computes the scale of a map.

Parameters:
p - the projection of the map
distance_in_proj_units - sample distance in projection units
distance_in_map_in_meters - true distance of the sample in meters
Returns:

inTwoDigits

public static java.lang.String inTwoDigits(int n)

isLatLonProjection

public static boolean isLatLonProjection(java.lang.String abbrev)