4.3. The Lat49.Tile Methods

The Lat49.Tile object provides methods for converting zoom levels from some common map APIs to the Lat49 convention, as well as for computing the zoom level based on the geographic coverage of a map image.

Functions in class Lat49.Tile:

 Number computeZoomLevel(latmin, lonmin, latmax, lonmax, pixelDist);
  

Returns the nearest zoom level based on the pixel distance between two geographic points. (latmin,lonmin) and (latmax,lonmax) are the geographic coordinates (in degrees) of the two points. pixelDist is the distance in pixels between the two points on the map image.

 Number convertGMapZoom(zl);
  

Converts the given zoom level zl between the Google Maps Version 1 API and the Lat49 scheme. The conversion works in both directions.

 Number convertGMap2Zoom(zl);
  

Converts the given zoom level zl between the Google Maps Version 2 API and the Lat49 scheme. The conversion works in both directions.

 Number convertLiveZoom(zl);
  

Converts the given zoom level zl between the Live (Virtual Earth) API and the Lat49 scheme. The conversion works in both directions.

 Number convertYahooZoom(zl);
  

Converts the given zoom level zl between the Yahoo! Local API and the Lat49 scheme. The conversion works in both directions.

 Number convertMapQuestZoom(zl);
  

Converts the given zoom level zl between the MapQuest API and the Lat49 scheme. The conversion only works in the one direction, and cannot be used to convert from the Lat49 to the MapQuest scheme.

The Lat49.Tile object also provides methods for converting between tile indices and geographic coordinates. Publishers that use the Lat49.AdHelper class to fetch ads will not need to use the following conversion functions.

Functions in class Lat49.Tile:

 Number latToYAtZ(latitude, zl);
  

Returns the Y coordinate in tile space for the given latitude (in degrees) at zoom level zl.

 Number yToLatAtZ(y, zl);
  

Returns the latitude (in degrees) for y at zoom level zl .

 Number lonToXAtZ(longitude, zl);
  

Returns the X coordinate in tile space for the given longitude (in degrees) at zoom level zl .

 Number xToLonAtZ(x, zl);
  

Returns the longitude (in degrees) for x at zoom level zl .