google.maps.LatLng
class
A LatLng
is a point in geographical coordinates: latitude and longitude.
Although the default map projection associates longitude with the x-coordinate of the map, and latitude with the y-coordinate, the latitude coordinate is always written first, followed by the longitude.
Notice that you cannot modify the coordinates of a LatLng
. If you want to compute another point, you have to create a new one.
<p> Most methods that accept LatLng
objects also accept a LatLngLiteral
object, so that the following are equivalent: </p>
map.setCenter({lat: -34, lng: 151}); </pre>LatLng
: </p>
Constructor | |
---|---|
LatLng |
LatLng(lat, lng[, noWrap]) Parameters:
Creates a LatLng object representing a geographic point. Latitude is specified in degrees within the range [-90, 90]. Longitude is specified in degrees within the range [-180, 180]. Set noWrap to true to enable values outside of this range. Note the ordering of latitude and longitude. |
Methods | |
---|---|
equals |
equals(other) Parameters:
Return Value:
boolean Comparison function. |
lat |
lat() Parameters: None
Return Value:
number Returns the latitude in degrees. |
lng |
lng() Parameters: None
Return Value:
number Returns the longitude in degrees. |
toJSON |
toJSON() Parameters: None
Return Value:
LatLngLiteral Converts to JSON representation. This function is intended to be used via JSON.stringify . |
toString |
toString() Parameters: None
Return Value:
string Converts to string representation. |
toUrlValue |
toUrlValue([precision]) Parameters:
Return Value:
string Returns a string of the form "lat,lng" for this LatLng. We round the lat/lng values to 6 decimal places by default. |