de.cm.osm2po.sd.routing
Class SdGeoUtils

java.lang.Object
  extended by de.cm.osm2po.sd.routing.SdGeoUtils

public class SdGeoUtils
extends java.lang.Object


Field Summary
static double DEG
           
static double EPSG_900913_CONST
           
static double GRAD_KM
           
static double PI_HALF
           
static double RAD
           
static double RAD_HALF
           
static double RADIUS_EARTH_KM
           
 
Method Summary
static double calcClockAngle(long coord1, long coord2)
          Calculates the angle between two points, while taking the cosine into account for accurate mercator like projections.
static double calcDistanceEuklid(double lat1, double lon1, double lat2, double lon2)
          Calculates the real distance between two points.
static double calcDistanceFast(float lat1, float lon1, float lat2, float lon2)
          Calculates the real distance between two points.
static double calcDistanceSphere(double lat1, double lon1, double lat2, double lon2)
          Calculates the real distance between two points.
static double calcDistanceSphere(long coord1, long coord2)
          Calculates the real distance between two points.
static double calcLengthKm(long[] coords)
           
static double calcTurnAngle(long coord1, long coord2)
          Calculates the angle between two points, while taking the cosine into account for accurate mercator like projections.
static float cosDeg(float deg)
           
static float cosRad(float rad)
           
static int createZoneId(double lat, double lon)
          Snaps a coordinate onto a 0.01-Degrees-Grid.
static double EPSG_4326_TO_900913_Lat(double lat)
           
static double EPSG_4326_TO_900913_Lon(double lon)
           
static double EPSG_900913_TO_4326_Lat(double lat)
           
static double EPSG_900913_TO_4326_Lon(double lon)
           
static int[] expandZone(int zoneId, int r)
          Expands a zone with surrounding zones.
static long toCoord(double lat, double lon)
           
static double toLat(long latLon)
           
static double toLon(long latLon)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RADIUS_EARTH_KM

public static final double RADIUS_EARTH_KM
See Also:
Constant Field Values

GRAD_KM

public static final double GRAD_KM
See Also:
Constant Field Values

EPSG_900913_CONST

public static final double EPSG_900913_CONST
See Also:
Constant Field Values

PI_HALF

public static final double PI_HALF
See Also:
Constant Field Values

RAD

public static final double RAD
See Also:
Constant Field Values

DEG

public static final double DEG
See Also:
Constant Field Values

RAD_HALF

public static final double RAD_HALF
See Also:
Constant Field Values
Method Detail

cosRad

public static final float cosRad(float rad)

cosDeg

public static final float cosDeg(float deg)

calcDistanceSphere

public static double calcDistanceSphere(long coord1,
                                        long coord2)
Calculates the real distance between two points. Assumes that the earth is a sphere. Calls calcDistanceSphere(double, double, double, double)

Parameters:
coord1 - long coded
coord2 - long coded
Returns:
double Kilometer

calcDistanceSphere

public static double calcDistanceSphere(double lat1,
                                        double lon1,
                                        double lat2,
                                        double lon2)
Calculates the real distance between two points. Assumes that the earth is a sphere.

Parameters:
lat1 - y1 double
lon1 - x1 double
lat2 - y2 double
lon2 - x2 double
Returns:
double Kilometer
See Also:
calcDistanceEuklid(double, double, double, double)

calcDistanceEuklid

public static double calcDistanceEuklid(double lat1,
                                        double lon1,
                                        double lat2,
                                        double lon2)
Calculates the real distance between two points. Assumes that the earth is a flat map.

Parameters:
lat1 - y1 double
lon1 - x1 double
lat2 - y2 double
lon2 - x2 double
Returns:
double Kilometer
See Also:
calcDistanceSphere(double, double, double, double)

calcDistanceFast

public static double calcDistanceFast(float lat1,
                                      float lon1,
                                      float lat2,
                                      float lon2)
Calculates the real distance between two points. Assumes that the earth is a flat map. Additinally uses some faster but less accurate formulas.

Parameters:
lat1 - y1 float
lon1 - x1 float
lat2 - y2 float
lon2 - x2 float
Returns:
double Kilometer
See Also:
calcDistanceEuklid(double, double, double, double)

createZoneId

public static int createZoneId(double lat,
                               double lon)
Snaps a coordinate onto a 0.01-Degrees-Grid.

Parameters:
lat - double
lon - double
Returns:
int id of cell.

expandZone

public static int[] expandZone(int zoneId,
                               int r)
Expands a zone with surrounding zones.

Parameters:
zoneId - int
r - int number of zone thickness.
Returns:
int[]-Array of all zoneIds.

EPSG_4326_TO_900913_Lon

public static double EPSG_4326_TO_900913_Lon(double lon)

EPSG_900913_TO_4326_Lon

public static double EPSG_900913_TO_4326_Lon(double lon)

EPSG_4326_TO_900913_Lat

public static double EPSG_4326_TO_900913_Lat(double lat)

EPSG_900913_TO_4326_Lat

public static double EPSG_900913_TO_4326_Lat(double lat)

toCoord

public static long toCoord(double lat,
                           double lon)

toLat

public static double toLat(long latLon)

toLon

public static double toLon(long latLon)

calcLengthKm

public static double calcLengthKm(long[] coords)

calcClockAngle

public static double calcClockAngle(long coord1,
                                    long coord2)
Calculates the angle between two points, while taking the cosine into account for accurate mercator like projections. Calls calcTurnAngle(long, long) and applies a simple correction.

Parameters:
coord1 - long coded.
coord2 - long coded.
Returns:
angle in degrees, where north is 0, right +90 and left +270.

calcTurnAngle

public static double calcTurnAngle(long coord1,
                                   long coord2)
Calculates the angle between two points, while taking the cosine into account for accurate mercator like projections.

Parameters:
coord1 - long coded.
coord2 - long coded.
Returns:
angle in degrees, where north is 0, right +90 and left -90.

osm2po-sd-5.0.0 (c) December 24 2014 Carsten Moeller - info@osm2po.de