new SuperMap.LonLat(lon, lat, location)
Name | Type | Default | Description |
---|---|---|---|
lon |
number | 0.0 |
optional
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 | 0.0 |
optional
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. |
location |
Array.<float> |
optional
If you want to set it at the same time, use an array combined by the lon and lat. |
Example
var lonLat = new SuperMap.LonLat(30,45);
Members
-
latfloat
-
The y-axis coordinate in map units. The default value is 0.0
- Default Value: 0.0
lonfloat
The x-axis coordinate in map units.
- Default Value: 0.0
Methods
-
SuperMap.LonLat.fromArray(arr){SuperMap.LonLat}
LonLat.js, line 167 -
Get a SuperMap.LonLat object by a array.
Name Type Description arr
Array.<float> The format of the array.It's length must be 2:[Lon,Lat]. For example: [5,-42]
Returns:
Type Description SuperMap.LonLat Return to a SuperMap.LonLat object. -
SuperMap.LonLat.fromString(str){SuperMap.LonLat}
LonLat.js, line 153 -
Get a SuperMap.LonLat object by a string.
Name Type Description str
string The format of the string:Lon+","+Lat. For instance:"100,50"
Returns:
Type Description SuperMap.LonLat Return to a SuperMap.LonLat object. Example
var str = "100,50"; var lonLat = SuperMap.LonLat.fromString(str);
-
add(lon, lat){SuperMap.LonLat}
LonLat.js, line 71 -
Returns a new LonLat object with the lon and lat passed-in added to this’s.
Name Type Description lon
float The x-axis coordinate in map units.
lat
float The y-axis coordinate in map units.
Returns:
Type Description SuperMap.LonLat Return a new LonLat object with the lon and lat passed-in added to this’s. Example
var lonLat1 = new SuperMap.LonLat(100,50); var lonLat2 = lonLat1.add(100,50);
-
clone(){SuperMap.LonLat}
LonLat.js, line 59 -
Copy the LonLat object, and returns new LonLat object with the same lon and lat values.
Returns:
Type Description SuperMap.LonLat Return new LonLat object with the same lon and lat values. Example
var lonLat1 = new SuperMap.LonLat(100,50); var lonLat2 = lonLat1.clone();
-
destroy()
LonLat.js, line 140 -
Destroy the object. All properties of the object will be null after it is destroyed.
Example
var lonLat = new SuperMap.LonLat(100,50); lonLat.destroy();
-
equals(ll){boolean}
LonLat.js, line 89 -
Determines whether the two LonLat objects are identical or not.
Name Type Description ll
SuperMap.LonLat The coordinate object needs to compare.
Returns:
Type Description boolean Boolean value indicating whether the passed-in LonLat object has the same lon and lat components as this. Note: if ll passed in is null, returns false. Example
var lonLat1 = new SuperMap.LonLat(100,50); var lonLat2 = new SuperMap.LonLat(100,50); var isEquals = lonLat1.equals(lonLat2);
-
toShortString(){string}
LonLat.js, line 47 -
Transform the LonLat object into a shortened string.
Returns:
Type Description string Shortened String representation of LonLat object. For example: "100,50". Example
var lonLat = new SuperMap.LonLat(100,50); var str = lonLat.toShortString();
-
toString(){string}
LonLat.js, line 35 -
Return the string format of this object.
Returns:
Type Description string For example: "lon=100,lat=50" Example
var lonLat = new SuperMap.LonLat(100,50); var str = lonLat.toString();
-
wrapDateLine(maxExtent){SuperMap.LonLat}
LonLat.js, line 108 -
Convert coordinates to within the specified range object and return new coordinates. If the longitude is less than the minimum precision of the given range, the range width is added to the original longitude until the precision is within the range, and if the longitude is greater than the given range, the range width is subtracted from the original longitude. It means converting coordinates that are not in the longitude range to within the range (only convert lon, not convert lat, mainly for shifting to the date line).
Name Type Description maxExtent
SuperMap.Bounds The maximum extent for the layer.
Returns:
Type Description SuperMap.LonLat Return new coordinates. Example
var lonLat1 = new SuperMap.LonLat(420,50); var lonLat2 = lonLat1.wrapDateLine( new SuperMap.Bounds(-180,-90,180,90) );