com.ontimize.util.gis.extension.google
Class GoogleTileUtils

java.lang.Object
  extended by com.ontimize.util.gis.extension.google.GoogleTileUtils

public class GoogleTileUtils
extends java.lang.Object

A utility class to assist in encoding and decoding google tile references For reasons of my own longitude is treated as being between -180 and +180 and internally latitude is treated as being from -1 to +1 and then converted to a mercator projection before return. All rectangles are sorted so the width and height are +ve


Method Summary
static java.awt.image.BufferedImage getDebugTileFor(int x, int y, int zoom)
          Returns a buffered image with the corner lat/lon,x,y and zoom level written on it.
static java.awt.image.BufferedImage getDebugTileFor(java.lang.String keyholeString)
          Returns a buffered image with the corner lat/lon,keyhole id and zoom level written on it.
static java.awt.geom.Rectangle2D.Double getLatLong(int x, int y, int zoom)
          returns a Rectangle2D with x = lon, y = lat, width=lonSpan, height=latSpan for an x,y,zoom as used by google.
static java.awt.geom.Rectangle2D.Double getLatLong(java.lang.String keyholeStr)
          returns a Rectangle2D with x = lon, y = lat, width=lonSpan, height=latSpan for a keyhole string.
static java.lang.String getTileRef(double lon, double lat, int zoom)
          returns a keyhole string for a longitude (x), latitude (y), and zoom
static int getTileZoom(java.lang.String keyHoleString)
          returns the Google zoom level for the keyhole string.
static void main(java.lang.String[] args)
          Tests
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDebugTileFor

public static java.awt.image.BufferedImage getDebugTileFor(java.lang.String keyholeString)
Returns a buffered image with the corner lat/lon,keyhole id and zoom level written on it.

Parameters:
keyholeString - the keyhole string to return the image for.
Returns:
Requested buffered image

getDebugTileFor

public static java.awt.image.BufferedImage getDebugTileFor(int x,
                                                           int y,
                                                           int zoom)
Returns a buffered image with the corner lat/lon,x,y and zoom level written on it.


getLatLong

public static java.awt.geom.Rectangle2D.Double getLatLong(java.lang.String keyholeStr)
returns a Rectangle2D with x = lon, y = lat, width=lonSpan, height=latSpan for a keyhole string.


getLatLong

public static java.awt.geom.Rectangle2D.Double getLatLong(int x,
                                                          int y,
                                                          int zoom)
returns a Rectangle2D with x = lon, y = lat, width=lonSpan, height=latSpan for an x,y,zoom as used by google.


getTileRef

public static java.lang.String getTileRef(double lon,
                                          double lat,
                                          int zoom)
returns a keyhole string for a longitude (x), latitude (y), and zoom


getTileZoom

public static int getTileZoom(java.lang.String keyHoleString)
returns the Google zoom level for the keyhole string.


main

public static void main(java.lang.String[] args)
Tests