OpenLayers. LonLat

This class represents a longitude and latitude pair

Summary
This class represents a longitude and latitude pair
{Float} The x-axis coodinate in map units
{Float} The y-axis coordinate in map units
Create a new map location.
Return a readable string version of the lonlat
{String} Shortened String representation of OpenLayers.LonLat object.
{OpenLayers.LonLat} New OpenLayers.LonLat object with the same lon and lat values
Alternative constructor that builds a new OpenLayers.LonLat from a parameter string

Properties

lon

{Float} The x-axis coodinate in map units

lat

{Float} The y-axis coordinate in map units

Constructor

OpenLayers. LonLat

Create a new map location.

Parameters

lon{Number} The x-axis coordinate in map units.  If your map is in a geographic projection, this will be the Longitude.  Otherwise, it will be the x coordinate of the map location in your map units.
lat{Number} The y-axis coordinate in map units.  If your map is in a geographic projection, this will be the Latitude.  Otherwise, it will be the y coordinate of the map location in your map units.

Functions

toString

toString:function()

Return a readable string version of the lonlat

Returns

{String} String representation of OpenLayers.LonLat object.  (ex.  <i>”lon=5,lat=42”</i>)

toShortString

toShortString:function()

Returns

{String} Shortened String representation of OpenLayers.LonLat object.  (ex.  <i>”5, 42”</i>)

clone

clone:function()

Returns

{OpenLayers.LonLat} New OpenLayers.LonLat object with the same lon and lat values

add

add:function(lon,
lat)

Parameters

lon{Float}
lat{Float}

Returns

{OpenLayers.LonLat} A new OpenLayers.LonLat object with the lon and lat passed-in added to this’s.

equals

equals:function(ll)

Parameters

ll{OpenLayers.LonLat}

Returns

{Boolean} Boolean value indicating whether the passed-in OpenLayers.LonLat object has the same lon and lat components as this.  Note: if ll passed in is null, returns false

wrapDateLine

wrapDateLine: function(maxExtent)

Parameters

maxExtent{OpenLayers.Bounds}

Returns

{OpenLayers.LonLat} A copy of this lonlat, but wrapped around the “dateline” (as specified by the borders of maxExtent)

fromString

OpenLayers.LonLat.fromString = function(str)

Alternative constructor that builds a new OpenLayers.LonLat from a parameter string

Parameters

str{String} Comma-separated Lon,Lat coordinate string.  (ex.  <i>”5,40”</i>)

Returns

{OpenLayers.LonLat} New OpenLayers.LonLat object built from the passed-in String.

toString:function()
Return a readable string version of the lonlat
toShortString:function()
{String} Shortened String representation of OpenLayers.LonLat object.
clone:function()
{OpenLayers.LonLat} New OpenLayers.LonLat object with the same lon and lat values
Create a new map location.
add:function(lon,
lat)
equals:function(ll)
wrapDateLine: function(maxExtent)
OpenLayers.LonLat.fromString = function(str)
Alternative constructor that builds a new OpenLayers.LonLat from a parameter string
Instances of this class represent bounding boxes.