Package | com.google.maps |
Class | public class LatLng |
Method | Defined by | ||
---|---|---|---|
LatLng(lat:Number, lng:Number, opt_noCorrect:Boolean = false)
Constructs a LatLng.
| LatLng | ||
Returns the angle (radians) between this point and the given point.
| LatLng | ||
Returns a new LatLng object that is a copy of this.
| LatLng | ||
distanceFrom(other:LatLng, opt_radius:Number):Number
Returns the distance, in meters, from this point to the given point.
| LatLng | ||
Tests whether this LatLng is coincident with another specified LatLng,
allowing for numerical rounding errors.
| LatLng | ||
fromRadians(lat:Number, lng:Number, opt_noCorrect:Boolean = false):LatLng
[static]
Creates a latlng from radian values.
| LatLng | ||
fromUrlValue(value:String):LatLng
[static]
Parses a string of the form "lat,lng" and returns a point with
those values.
| LatLng | ||
lat():Number
Returns the latitude in degrees.
| LatLng | ||
latRadians():Number
Returns the latitude in radians.
| LatLng | ||
lng():Number
Returns the longitude in degrees.
| LatLng | ||
lngRadians():Number
Returns the longitude in radians.
| LatLng | ||
toString():String
Returns a string representation of this LatLng, for example
'48.8584, 2.2944' for Paris.
| LatLng | ||
toUrlValue(opt_precision:Number = 6):String
Returns a string of the form "lat,lng" for this LatLng.
| LatLng | ||
[static]
Returns a LatLng that is a copy of the given LatLng, but with latitude
clamped to the range [-90, 90] and longitude wrapped to the range
[-180, 180].
| LatLng |
Constant | Defined by | ||
---|---|---|---|
EARTH_RADIUS : Number = 6378137 [static]
The equatorial radius of the earth in meters.
| LatLng |
LatLng | () | constructor |
public function LatLng(lat:Number, lng:Number, opt_noCorrect:Boolean = false)
Constructs a LatLng. If opt_noCorrect is false, we make sure the latitude and longitude are valid, wrapping the longitude appropriately around the dateline and clamping the latitude at the poles. Valid values for longitude lie in the range [-180,180]. Valid values for latitude lie in the range [-90,90].
Parameterslat:Number — Latitude.
|
|
lng:Number — Longitude.
|
|
opt_noCorrect:Boolean (default = false ) — Flag: do not correct to valid range.
|
var sydney:LatLng = new LatLng(-33.8581, 151.2149); var bound:LatLng = new LatLng(10, 190); // longitude set to -170 var unbound:LatLng = new LatLng(10, 190, true); // longitude set to 190
angleFrom | () | method |
public function angleFrom(other:LatLng):Number
Returns the angle (radians) between this point and the given point. This is also the distance between those points on a unit sphere.
Parametersother:LatLng — Other LatLng
|
Number — Distance in radians between this and other.
|
var london:LatLng = new LatLng(51.53, -0.08); var paris:LatLng = new LatLng(48.8, 2.33); trace("angle: " + paris.angleFrom(london));
clone | () | method |
public function clone():LatLng
Returns a new LatLng object that is a copy of this.
ReturnsLatLng —
The new copy.
|
distanceFrom | () | method |
public function distanceFrom(other:LatLng, opt_radius:Number):Number
Returns the distance, in meters, from this point to the given point. Since we approximate the earth as a sphere, the distance could be off by as much as 0.3%.
Parametersother:LatLng — Other LatLng
|
|
opt_radius:Number — The radius of the planet (default EARTH_RADIUS).
|
Number — Distance in meters between this and other.
|
var london:LatLng = new LatLng(51.53, -0.08); var sydney:LatLng = new LatLng(-34.0, 151.0); trace("km: " + sydney.distanceFrom(london) / 1000);
equals | () | method |
public function equals(other:LatLng):Boolean
Tests whether this LatLng is coincident with another specified LatLng, allowing for numerical rounding errors.
Parametersother:LatLng — LatLng against which to compare.
|
Boolean — true if this LatLng is coincident with the other.
|
fromRadians | () | method |
public static function fromRadians(lat:Number, lng:Number, opt_noCorrect:Boolean = false):LatLng
Creates a latlng from radian values.
Parameterslat:Number — Latitude in radians.
|
|
lng:Number — Longitude in radians.
|
|
opt_noCorrect:Boolean (default = false ) — Flag to prevent correction to valid range.
|
LatLng —
Resulting LatLng object.
|
fromUrlValue | () | method |
public static function fromUrlValue(value:String):LatLng
Parses a string of the form "lat,lng" and returns a point with those values.
Parametersvalue:String — "lat,lng" string to parse.
|
LatLng —
Resulting LatLng.
|
var location:LatLng = LatLng.fromUrlValue("-34,151");
lat | () | method |
public function lat():Number
Returns the latitude in degrees.
ReturnsNumber — Latitude in degrees.
|
latRadians | () | method |
public function latRadians():Number
Returns the latitude in radians.
ReturnsNumber — Latitude in radians.
|
lng | () | method |
public function lng():Number
Returns the longitude in degrees.
ReturnsNumber — Longitude in degrees.
|
lngRadians | () | method |
public function lngRadians():Number
Returns the longitude in radians.
ReturnsNumber — Longitude in radians.
|
toString | () | method |
public function toString():String
Returns a string representation of this LatLng, for example '48.8584, 2.2944' for Paris.
ReturnsString — String representation of this LatLng.
|
toUrlValue | () | method |
public function toUrlValue(opt_precision:Number = 6):String
Returns a string of the form "lat,lng" for this LatLng. We round the lat/lng values to 6 decimal places by default.
precision | approximate error |
---|---|
-1 | 1000 kilometers / 700 miles |
0 | 100 kilometers / 70 miles |
1 | 10 kilometers / 7 miles |
2 | 1 kilometer / 0.7 miles |
3 | 100 meters / 300 feet |
4 | 10 meters / 30 feet |
5 | 1 meter / 3 feet |
6 | 10 centimeters / 4 inches |
7 | 1 centimeter (a nickel) |
opt_precision:Number (default = 6 ) — Number of digits following decimal point.
|
String — String representation suitable for use as a URL parameter,
for example '48.858405,2.294362' for Paris.
|
wrapLatLng | () | method |
public static function wrapLatLng(latLng:LatLng):LatLng
Returns a LatLng that is a copy of the given LatLng, but with latitude clamped to the range [-90, 90] and longitude wrapped to the range [-180, 180].
ParameterslatLng:LatLng — Unbound LatLng object.
|
LatLng —
Bound LatLng object.
|
EARTH_RADIUS | constant |
public static const EARTH_RADIUS:Number = 6378137
The equatorial radius of the earth in meters. Assumes a perfectly spherical earth, and hence is approximate. The earth's radius in fact varies between 6357 km at the pole to 6378 KM at the equator - a difference of 0.3%.