Class deCarta.Mobile.Position
Represents a geographic position as a pair of lat, lon values Also provides methods to easily convert between geo positions (lat,lon) and pixel coordinates (x,y) given a zoom level, and vice versa.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
deCarta.Mobile.Position(lat, lon)
Represents a geographic position as a pair of lat, lon values
|
| Method Attributes | Method Name and Description |
|---|---|
|
clone()
Returns clone of this position
|
|
|
getLat()
Returns the latitude associated with this position
|
|
|
getLon()
Returns the longitude associated with this positon
|
|
|
Returns an object with lat and lon in pixels
|
|
|
getTileAtZoom(zoom)
Returns the N (North) and E (East) params of this position at a specific zoom
|
|
|
getX(zoom)
Returns the horizontal position on the map window of this position, in pixels
|
|
|
getY(zoom)
Returns the vertical position on the map window of this position, in pixels
|
|
|
setXY(x, y, zoom)
Sets Lat and Lon from a pixel position and a zoom level
|
|
|
toString(n)
Returns a string representation of the position
|
Class Detail
deCarta.Mobile.Position(lat, lon)
Represents a geographic position as a pair of lat, lon values
- Parameters:
- {float} lat
- The Latitude
- {float} lon
- The Longitude
Method Detail
{deCarta.Mobile.Position}
clone()
Returns clone of this position
- Returns:
- {deCarta.Mobile.Position} pos
{float}
getLat()
Returns the latitude associated with this position
- Returns:
- {float} Latitude
{float}
getLon()
Returns the longitude associated with this positon
- Returns:
- {float} Longitude
{object}
getPixelPoint(z)
Returns an object with lat and lon in pixels
- Parameters:
- z
- Returns:
- {object} An object in the format {x: lat, y: lon}
getTileAtZoom(zoom)
Returns the N (North) and E (East) params of this position at a specific zoom
- Parameters:
- {float} zoom
- Current zoom level (20=maxzoom, 1=minzoom) return {object} Object with the structure {N: Northing value, E: easting value}
{float}
getX(zoom)
Returns the horizontal position on the map window of this position, in pixels
- Parameters:
- {float} zoom
- Current zoom level (20=maxzoom, 1=minzoom)
- Returns:
- {float} X coordinate of map window for this position
{float}
getY(zoom)
Returns the vertical position on the map window of this position, in pixels
- Parameters:
- {float} zoom
- Current zoom level (20=maxzoom, 1=minzoom)
- Returns:
- {float} Y coordinate of map window for this position
setXY(x, y, zoom)
Sets Lat and Lon from a pixel position and a zoom level
- Parameters:
- {int} x
- X coordinate of the pixel in the map window
- {int} y
- Y coordinate of the pixel in the map window
- {float} zoom
- Current zoom level (20=maxzoom, 1=minzoom)
{string}
toString(n)
Returns a string representation of the position
- Parameters:
- n
- Returns:
- {string} Space-separated string of the format 'lat lon'