org.zkoss.gmaps
Class GmapsUtil

java.lang.Object
  extended by org.zkoss.gmaps.GmapsUtil

public class GmapsUtil
extends java.lang.Object

Utility class regrding Gmaps.

Since:
2.0_10
Author:
henrichen

Constructor Summary
GmapsUtil()
           
 
Method Summary
static double[] getBounds(double lat, double lng, int width, int height, int zoomLevel)
          Returns the bounds per the given center latitude, longitude, view port width, view port height, and zoomLevel.
static int[] latlngToXy(double lat, double lng, int zoomLevel)
          Convert the latitude and longitude to x, y pixels.
static double[] xyToLatlng(int x, int y, int zoomLevel)
          Convert the x, y pixels to latitude and longitude.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GmapsUtil

public GmapsUtil()
Method Detail

latlngToXy

public static int[] latlngToXy(double lat,
                               double lng,
                               int zoomLevel)
Convert the latitude and longitude to x, y pixels. This is based on the Mercator Projection (check http://en.wikipedia.org/wiki/Mercator_projection) as used in Google Maps

Parameters:
lat - the latitude in degree
lng - the longitude in degree
zoomLevel - the zoom level of the map
Returns:
int[] with int[0] the x and int[1] the y

xyToLatlng

public static double[] xyToLatlng(int x,
                                  int y,
                                  int zoomLevel)
Convert the x, y pixels to latitude and longitude. This is based on the Mercator Projection (check http://en.wikipedia.org/wiki/Mercator_projection) as used in Google Maps.

Parameters:
x - the x in pixels
y - the y in pixels
zoomLevel - the zoom level of the map
Returns:
double[] with double[0] the latitude and double[1] the longitude

getBounds

public static double[] getBounds(double lat,
                                 double lng,
                                 int width,
                                 int height,
                                 int zoomLevel)
Returns the bounds per the given center latitude, longitude, view port width, view port height, and zoomLevel.

Parameters:
lat - the center latitude
lng - the center longitude
width - the view port width
height - the view port height
zoomLevel - the zoom level
Returns:
double[] with double[0] swlat, double[1] swlng, double[2] nelat, double[3] nelng


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.