A LatLng
is a point in geographical coordinates: latitude
and longitude.
LatLng
. If you want to compute
another point, you have to create a new one. Most methods that
accept LatLng
objects also accept a LatLngLiteral
object, so that the
following are equivalent:
map.setCenter(new google.maps.LatLng(-34, 151));
map.setCenter({lat: -34, lng: 151});
The constructor also accepts literal objects, and converts
them to instances of LatLng
. The possible calls to the
constructor are below:
new google.maps.LatLng(-34, 151);
new google.maps.LatLng(-34, 151, true);
new google.maps.LatLng({lat: -34, lng: 151});
new google.maps.LatLng({lat: -34, lng: 151}, true);
new google.maps.LatLng({lat: -34, lng: 151}, null, true);
Comparison function.
Returns the latitude in degrees.
Returns the longitude in degrees.
Converts to JSON representation. This function is intended to be used via
JSON.stringify
.
Converts to string representation.
Returns a string of the form "lat,lng" for this LatLng. We round the lat/lng values to 6 decimal places by default.
Generated using TypeDoc
A
LatLng
is a point in geographical coordinates: latitude and 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.Most methods that accept
LatLng
objects also accept aLatLngLiteral
object, so that the following are equivalent:The constructor also accepts literal objects, and converts them to instances of
LatLng
. The possible calls to the constructor are below: