deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.framework.util
Class MapUtils

java.lang.Object
  extended by org.deegree.framework.util.MapUtils

public class MapUtils
extends Object

Since:
2.0
Version:
$Revision: 20692 $, 1.0. $Revision: 20692 $, $Date: 2009-11-10 13:49:55 +0100 (Di, 10. Nov 2009) $
Author:
Andreas Poth, last edited by: $Author: apoth $

Field Summary
static double DEFAULT_PIXEL_SIZE
          The Value of a PixelSize
static double SQRT2
          The value of sqrt(2)
 
Constructor Summary
MapUtils()
           
 
Method Summary
static double calcDistance(double lon1, double lat1, double lon2, double lat2)
          calculates the distance in meters between two points in EPSG:4326 coodinates. this is a convenience method assuming the world is a ball
static double calcScale(int mapWidth, int mapHeight, Envelope bbox, CoordinateSystem crs, double pixelSize)
          calculates the map scale (denominator) as defined in the OGC SLD 1.0.0 specification
static double calcScaleWMS111(int mapWidth, int mapHeight, Envelope bbox, CoordinateSystem crs)
           
static double calcScaleWMS130(int mapWidth, int mapHeight, Envelope bbox, CoordinateSystem crs)
           
static Envelope ensureAspectRatio(Envelope bbox, double mapWith, double mapHeight)
          This method ensures the bbox is resized (shrunk) to match the aspect ratio defined by mapHeight/mapWidth
static Envelope scaleEnvelope(Envelope currentEnvelope, double currentScale, double requestedScale)
          The method calculates a new Envelope from the requestedBarValue It will either zoom in or zoom out of the actualBBOX depending on the ratio of the requestedBarValue to the actualBarValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQRT2

public static final double SQRT2
The value of sqrt(2)


DEFAULT_PIXEL_SIZE

public static final double DEFAULT_PIXEL_SIZE
The Value of a PixelSize

See Also:
Constant Field Values
Constructor Detail

MapUtils

public MapUtils()
Method Detail

calcScaleWMS111

public static double calcScaleWMS111(int mapWidth,
                                     int mapHeight,
                                     Envelope bbox,
                                     CoordinateSystem crs)
Parameters:
mapWidth -
mapHeight -
bbox -
crs -
Returns:
the WMS 1.1.1 scale (size of the diagonal pixel)

calcScaleWMS130

public static double calcScaleWMS130(int mapWidth,
                                     int mapHeight,
                                     Envelope bbox,
                                     CoordinateSystem crs)
Parameters:
mapWidth -
mapHeight -
bbox -
crs -
Returns:
the WMS 1.3.0 scale (horizontal size of the pixel, pixel size == 0.28mm)

calcScale

public static double calcScale(int mapWidth,
                               int mapHeight,
                               Envelope bbox,
                               CoordinateSystem crs,
                               double pixelSize)
                        throws RuntimeException
calculates the map scale (denominator) as defined in the OGC SLD 1.0.0 specification

Parameters:
mapWidth - map width in pixel
mapHeight - map height in pixel
bbox - bounding box of the map
crs - coordinate reference system of the map
pixelSize - size of one pixel of the map measured in meter
Returns:
a maps scale based on the diagonal size of a pixel at the center of the map in meter.
Throws:
RuntimeException

calcDistance

public static double calcDistance(double lon1,
                                  double lat1,
                                  double lon2,
                                  double lat2)
calculates the distance in meters between two points in EPSG:4326 coodinates. this is a convenience method assuming the world is a ball

Parameters:
lon1 -
lat1 -
lon2 -
lat2 -
Returns:
the distance in meters between two points in EPSG:4326 coords

scaleEnvelope

public static Envelope scaleEnvelope(Envelope currentEnvelope,
                                     double currentScale,
                                     double requestedScale)
The method calculates a new Envelope from the requestedBarValue It will either zoom in or zoom out of the actualBBOX depending on the ratio of the requestedBarValue to the actualBarValue

Parameters:
currentEnvelope - current Envelope
currentScale - the scale of the current envelope
requestedScale - requested scale value
Returns:
a new Envelope

ensureAspectRatio

public static final Envelope ensureAspectRatio(Envelope bbox,
                                               double mapWith,
                                               double mapHeight)
This method ensures the bbox is resized (shrunk) to match the aspect ratio defined by mapHeight/mapWidth

Parameters:
bbox -
mapWith -
mapHeight -
Returns:
a new bounding box with the aspect ratio given my mapHeight/mapWidth

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org