GLatLng [class]-GoogleMaps/API/doc/ClassReference/21-GLatLng-N☆E 学習帳

[ リロード ]   [ ソース ]  [ トップ | 一覧 | 単語検索 | 最新 | バックアップ | ヘルプ ]

Counter: 3263, today: 2, yesterday: 1

GLatLng [class]

http://www.google.com/apis/maps/docu­mentation/

Version 2 (2006.4) 新規

GLatLng is a point in geographical coordinates longitude and latitude.

Notice that although usual map projections associate longitude with the x-coordinate of the map, and latitude with the y-coordinate, the latitude cooridnate is always written first, followed by the longitude, as it is custom in cartography.

Notice also that you cannot modify the coordinates of a GLatLng. If you want to compute another point, you have to create a new one.

Constructor

Constructor Description
GLatLng(lat, lng, unbounded?) Notice the ordering of latitude and longitude. If the unbounded flag is true, then the numbers will be used as passed, oterwise latitude will be clamped to lie between -90 degrees and +90 degrees, and longitude will be wrapped to lie between -180 degrees and +180 degrees.

 

Methods

Methods Return Value Description
lat() Number Returns the latitude coordinate in degrees, as a number between -90 and +90. If the unbounded flag was set in the constructor, this coordinate can be outside this interval.
lng() Number Returns the longitude coordinate in degrees, as a number between -180 and +180. If the unbounded flag was set in the constructor, this coordinate can be outside this interval.
latRadians() Number Returns the latitude coordinate in radians, as a number between -PI/2 and +PI/2. If the unbounded flag was set in the constructor, this coordinate can be outside this interval.
lngRadians() Number Returns the longitude coordinate in radians, as a number between -PI and +PI. If the unbounded flag was set in the constructor, this coordinate can be outside this interval.
equals(other) Boolean Returns true iff the other size has equal components, within certain roundoff margins.
distanceFrom(other) Number Returns the distance, in meters, from this point to the given point. The earth is approximated as a sphere, hence the distance could be off by as much as 0.3%.
toUrlValue() String Returns a string that represents this point that is suitable for use as a URL paramater value. It contains the latitude and the longitide in degrees to 6 decimal digits, in this order, separated by a comma, without whitespace.

Example:
latRadians(), lngRadians() (緯度・経度をラジアン表示) → http://never-ever.info/googlemaps/ve­r2/radians.html
distanceFrom(other)(2点間の距離) → http://never-ever.info/googlemaps/ve­r2/distancefrom.html

 

Properties

These properties exist for backwards compatibility with v1 event handler functions only. They should not be used.

These properties mirror the return values of the lng() and lat() accessor methods and they allow a GLatLng to appear in places where a GPoint is expected by a v1 client. This is necessary where GLatLng appears in event details (i.e. in arguments of event handler functions). In contrast to method wrappers, it is impossible in the current infrastructure to create event wrappers.

Properties Type Description
x Number Deprecated.
y Number Deprecated.