com.bbn.openmap.dataAccess.mapTile
Class OSMMapTileCoordinateTransform

java.lang.Object
  extended by com.bbn.openmap.dataAccess.mapTile.OSMMapTileCoordinateTransform
All Implemented Interfaces:
MapTileCoordinateTransform

public class OSMMapTileCoordinateTransform
extends java.lang.Object
implements MapTileCoordinateTransform

The implementation of TileCoordinateTransformation for OpenStreetMap tile coordinate layout.

Author:
dietrick

Field Summary
protected  MercatorUVGCT transform
           
 
Fields inherited from interface com.bbn.openmap.dataAccess.mapTile.MapTileCoordinateTransform
TILE_SIZE, UVLR, UVUL
 
Constructor Summary
OSMMapTileCoordinateTransform()
           
 
Method Summary
 int[] getTileBoundsForProjection(java.awt.geom.Point2D upperLeft, java.awt.geom.Point2D lowerRight, int zoomLevel)
          Given a projection, provide the upper, lower, left and right tile coordinates that cover the projection area.
 MercatorUVGCT getTransform(int zoomLevel)
          The coordinate transformation object used for lat/lon uv conversions.
 boolean isYDirectionUp()
           
 java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon, int zoom)
           
 java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon, int zoom, java.awt.geom.Point2D ret)
           
 java.awt.geom.Point2D tileUVToLatLon(java.awt.geom.Point2D tileUV, int zoom)
           
 LatLonPoint tileUVToLatLon(java.awt.geom.Point2D tileUV, int zoom, LatLonPoint ret)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transform

protected MercatorUVGCT transform
Constructor Detail

OSMMapTileCoordinateTransform

public OSMMapTileCoordinateTransform()
Method Detail

latLonToTileUV

public java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon,
                                            int zoom)
Specified by:
latLonToTileUV in interface MapTileCoordinateTransform
Parameters:
latlon - a Point2D whose x component is the longitude and y component is the latitude
zoom - Tile Map Service (TMS) style zoom level (0-19 usually)
Returns:
The "tile number" whose x and y components each are floating point numbers that represent the distance in number of tiles from the origin of the whole map at this zoom level. At zoom=0, the lat,lon point of 0,0 maps to 0.5,0.5 since there is only one tile at zoom level 0.

latLonToTileUV

public java.awt.geom.Point2D latLonToTileUV(java.awt.geom.Point2D latlon,
                                            int zoom,
                                            java.awt.geom.Point2D ret)
Specified by:
latLonToTileUV in interface MapTileCoordinateTransform

tileUVToLatLon

public java.awt.geom.Point2D tileUVToLatLon(java.awt.geom.Point2D tileUV,
                                            int zoom)
Specified by:
tileUVToLatLon in interface MapTileCoordinateTransform
Parameters:
tileUV - a Point2D whose x,y coordinates represent the distance in number of tiles (each 256x256) from the origin (where the origin is 90lat,-180lon)
zoom - Tile Map Service (TMS) style zoom level (0-19 usually)
Returns:
a Point2D whose x coordinate is the longitude and y coordinate is the latitude

tileUVToLatLon

public LatLonPoint tileUVToLatLon(java.awt.geom.Point2D tileUV,
                                  int zoom,
                                  LatLonPoint ret)
Specified by:
tileUVToLatLon in interface MapTileCoordinateTransform

getTileBoundsForProjection

public int[] getTileBoundsForProjection(java.awt.geom.Point2D upperLeft,
                                        java.awt.geom.Point2D lowerRight,
                                        int zoomLevel)
Given a projection, provide the upper, lower, left and right tile coordinates that cover the projection area.

Specified by:
getTileBoundsForProjection in interface MapTileCoordinateTransform
Parameters:
upperLeft - lat/lon coordinate of upper left corner of bounding box.
lowerRight - lat/lon coordinate of lower right corner of bounding box.
zoomLevel - zoom level of desired tiles.
Returns:
int[], in top, left, bottom and right order.

isYDirectionUp

public boolean isYDirectionUp()
Specified by:
isYDirectionUp in interface MapTileCoordinateTransform
Returns:
if y coordinates for tiles increase as pixel values increase.

getTransform

public MercatorUVGCT getTransform(int zoomLevel)
Description copied from interface: MapTileCoordinateTransform
The coordinate transformation object used for lat/lon uv conversions.

Specified by:
getTransform in interface MapTileCoordinateTransform
Returns:
Mercator UVGGT for a particular zoom level.


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details