Coordinates Stay organized with collections Save and categorize content based on your preferences.
LatLngclass
google.maps.LatLngclass
ALatLng is a point in geographical coordinates: latitude and longitude.
- Latitude ranges between -90 and 90 degrees, inclusive. Values above or below this range will be clamped to the range [-90, 90]. This means that if the value specified is less than -90, it will be set to -90. And if the value is greater than 90, it will be set to 90.
- Longitude ranges between -180 and 180 degrees, inclusive. Values above or below this range will be wrapped so that they fall within the range. For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. This reflects the fact that longitudes wrap around the globe.
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 acceptLatLng objects also accept aLatLngLiteral object, so that the following are equivalent:
map.setCenter(new google.maps.LatLng(-34, 151));
map.setCenter({lat: -34, lng: 151});
The constructor also acceptsLatLngLiteral andLatLng objects. If aLatLng instance is passed to the constructor, a copy is created.
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(new google.maps.LatLng(-34, 151));
new google.maps.LatLng(new google.maps.LatLng(-34, 151), true);
Access by callingconst {LatLng} = await google.maps.importLibrary("core").
SeeLibraries in the Maps JavaScript API.
Constructor | |
|---|---|
LatLng | LatLng(latOrLatLngOrLatLngLiteral[, lngOrNoClampNoWrap, noClampNoWrap])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). SetnoClampNoWrap totrue to enable values outside of this range. Note the ordering of latitude and longitude. |
Methods | |
|---|---|
equals | equals(other)Parameters:
Return Value: booleanComparison function. |
lat | lat()Parameters: None Return Value: numberReturns the latitude in degrees. |
lng | lng()Parameters: None Return Value: numberReturns the longitude in degrees. |
toJSON | toJSON()Parameters: None Return Value: LatLngLiteralConverts to JSON representation. This function is intended to be used via JSON.stringify. |
toString | toString()Parameters: None Return Value: stringConverts to string representation. |
toUrlValue | toUrlValue([precision])Parameters:
Return Value: stringReturns a string of the form "lat,lng" for this LatLng. We round the lat/lng values to 6 decimal places by default. |
LatLngLiteralinterface
google.maps.LatLngLiteralinterface
Object literals are accepted in place ofLatLng objects, as a convenience, in many places. These are converted toLatLng objects when the Maps API encounters them.
Examples:
map.setCenter({lat: -34, lng: 151});
new google.maps.Marker({position: {lat: -34, lng: 151}, map: map});LatLng object literals are not supported in the Geometry library.
Properties | |
|---|---|
lat | Type: numberLatitude in degrees. Values will be clamped to the range [-90, 90]. This means that if the value specified is less than -90, it will be set to -90. And if the value is greater than 90, it will be set to 90. |
lng | Type: numberLongitude in degrees. Values outside the range [-180, 180] will be wrapped so that they fall within the range. For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. This reflects the fact that longitudes wrap around the globe. |
LatLngBoundsclass
google.maps.LatLngBoundsclass
ALatLngBounds instance represents a rectangle in geographical coordinates, including one that crosses the 180 degrees longitudinal meridian.
Access by callingconst {LatLngBounds} = await google.maps.importLibrary("core").
SeeLibraries in the Maps JavaScript API.
Constructor | |
|---|---|
LatLngBounds | LatLngBounds([swOrLatLngBounds, ne])Parameters:
Constructs a rectangle from the points at its south-west and north-east corners. |
Constants | |
|---|---|
MAX_BOUNDS | LatLngBounds for the max bounds of the Earth. These bounds will encompass the entire globe. |
Methods | |
|---|---|
contains | contains(latLng)Parameters:
Return Value: booleanReturns true if the given lat/lng is in this bounds. |
equals | equals(other)Parameters:
Return Value: booleanReturns true if this bounds approximately equals the given bounds. |
extend | extend(point)Parameters:
Return Value: LatLngBoundsExtends this bounds to contain the given point. |
getCenter | getCenter()Parameters: None Return Value: LatLngComputes the center of this LatLngBounds |
getNorthEast | getNorthEast()Parameters: None Return Value: LatLngReturns the north-east corner of this bounds. |
getSouthWest | getSouthWest()Parameters: None Return Value: LatLngReturns the south-west corner of this bounds. |
intersects | intersects(other)Parameters:
Return Value: booleanReturns true if this bounds shares any points with the other bounds. |
isEmpty | isEmpty()Parameters: None Return Value: booleanReturns if the bounds are empty. |
toJSON | toJSON()Parameters: None Return Value: LatLngBoundsLiteralConverts to JSON representation. This function is intended to be used via JSON.stringify. |
toSpan | toSpan()Parameters: None Return Value: LatLngConverts the given map bounds to a lat/lng span. |
toString | toString()Parameters: None Return Value: stringConverts to string. |
toUrlValue | toUrlValue([precision])Parameters:
Return Value: stringReturns a string of the form "lat_lo,lng_lo,lat_hi,lng_hi" for this bounds, where "lo" corresponds to the southwest corner of the bounding box, while "hi" corresponds to the northeast corner of that box. |
union | union(other)Parameters:
Return Value: LatLngBoundsExtends this bounds to contain the union of this and the given bounds. |
LatLngBoundsLiteralinterface
google.maps.LatLngBoundsLiteralinterface
Object literals are accepted in place ofLatLngBounds objects throughout the API. These are automatically converted toLatLngBounds objects. Allsouth,west,north andeast must be set, otherwise an exception is thrown.
Properties | |
|---|---|
east | Type: numberEast longitude in degrees. Values outside the range [-180, 180] will be wrapped to the range [-180, 180). For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. This reflects the fact that longitudes wrap around the globe. |
north | Type: numberNorth latitude in degrees. Values will be clamped to the range [-90, 90]. This means that if the value specified is less than -90, it will be set to -90. And if the value is greater than 90, it will be set to 90. |
south | Type: numberSouth latitude in degrees. Values will be clamped to the range [-90, 90]. This means that if the value specified is less than -90, it will be set to -90. And if the value is greater than 90, it will be set to 90. |
west | Type: numberWest longitude in degrees. Values outside the range [-180, 180] will be wrapped to the range [-180, 180). For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. This reflects the fact that longitudes wrap around the globe. |
LatLngAltitudeclass
google.maps.LatLngAltitudeclass
ALatLngAltitude is a 3D point in geographical coordinates: latitude, longitude, and altitude.
- Latitude ranges between -90 and 90 degrees, inclusive. Values above or below this range will be clamped to the range [-90, 90]. This means that if the value specified is less than -90, it will be set to -90. And if the value is greater than 90, it will be set to 90.
- Longitude ranges between -180 and 180 degrees, inclusive. Values above or below this range will be wrapped so that they fall within the range. For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. This reflects the fact that longitudes wrap around the globe.
- Altitude is measured in meters. Positive values denote heights above ground level, and negative values denote heights underneath the ground surface.
This class implementsLatLngAltitudeLiteral.
This class implementsLatLngLiteral.
Access by callingconst {LatLngAltitude} = await google.maps.importLibrary("core").
SeeLibraries in the Maps JavaScript API.
Constructor | |
|---|---|
LatLngAltitude | LatLngAltitude(value[, noClampNoWrap])Parameters:
|
Properties | |
|---|---|
altitude | Type: numberReturns the altitude. |
lat | Type: numberReturns the latitude. |
lng | Type: numberReturns the longitude. |
Methods | |
|---|---|
equals | equals(other)Parameters:
Return Value: boolean Whether the two objects are equal.Comparison function. |
toJSON | toJSON()Parameters: None Return Value: LatLngAltitudeLiteral A JSON representation of this object. |
LatLngAltitudeLiteralinterface
google.maps.LatLngAltitudeLiteralinterface
Object literals are accepted in place ofLatLngAltitude objects, as a convenience, in many places. These are converted toLatLngAltitude objects when the Maps API encounters them.
This interface extendsLatLngLiteral.
Properties | |
|---|---|
altitude | Type: numberDefault: 0Distance (in meters) above the ground surface. Negative value means underneath the ground surface. |
lat | Type: numberLatitude in degrees. Values will be clamped to the range [-90, 90]. This means that if the value specified is less than -90, it will be set to -90. And if the value is greater than 90, it will be set to 90. |
lng | Type: numberLongitude in degrees. Values outside the range [-180, 180] will be wrapped so that they fall within the range. For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. This reflects the fact that longitudes wrap around the globe. |
Pointclass
google.maps.Pointclass
Access by callingconst {Point} = await google.maps.importLibrary("core").
SeeLibraries in the Maps JavaScript API.
Constructor | |
|---|---|
Point | Point(x, y)Parameters:
A point on a two-dimensional plane. |
Properties | |
|---|---|
x | Type: numberThe X coordinate |
y | Type: numberThe Y coordinate |
Methods | |
|---|---|
equals | equals(other)Parameters:
Return Value: booleanCompares two Points |
toString | toString()Parameters: None Return Value: stringReturns a string representation of this Point. |
Sizeclass
google.maps.Sizeclass
Access by callingconst {Size} = await google.maps.importLibrary("core").
SeeLibraries in the Maps JavaScript API.
Constructor | |
|---|---|
Size | Size(width, height[, widthUnit, heightUnit])Parameters:
Two-dimensional size, where width is the distance on the x-axis, and height is the distance on the y-axis. |
Properties | |
|---|---|
height | Type: numberThe height along the y-axis, in pixels. |
width | Type: numberThe width along the x-axis, in pixels. |
Methods | |
|---|---|
equals | equals(other)Parameters:
Return Value: booleanCompares two Sizes. |
toString | toString()Parameters: None Return Value: stringReturns a string representation of this Size. |
Paddinginterface
google.maps.Paddinginterface
Properties | |
|---|---|
bottomoptional | Type: numberoptionalPadding for the bottom, in pixels. |
leftoptional | Type: numberoptionalPadding for the left, in pixels. |
rightoptional | Type: numberoptionalPadding for the right, in pixels. |
topoptional | Type: numberoptionalPadding for the top, in pixels. |
CircleLiteralinterface
google.maps.CircleLiteralinterface
Object literal which represents a circle.
This interface extendsCircleOptions.
Properties | |
|---|---|
center | Type: LatLng|LatLngLiteralThe center of the Circle. |
radius | Type: numberThe radius in meters on the Earth's surface. |
Inherited:clickable,draggable,editable,fillColor,fillOpacity,map,strokeColor,strokeOpacity,strokePosition,strokeWeight,visible,zIndex | |
Orientation3Dclass
google.maps.Orientation3Dclass
AOrientation3D is a three-dimensional vector used for standard mathematical rotation transformations along heading, tilt, and roll.
- heading is an angle in the range [0, 360) degrees.
- tilt is an angle in the range [0, 360) degrees.
- roll is an angle in the range [0, 360) degrees.
This class implementsOrientation3DLiteral.
Access by callingconst {Orientation3D} = await google.maps.importLibrary("core").
SeeLibraries in the Maps JavaScript API.
Constructor | |
|---|---|
Orientation3D | Orientation3D(value)Parameters:
|
Properties | |
|---|---|
heading | Type: numberDefault: 0Rotation about the z-axis (normal to the Earth's surface). A value of 0 (the default) equals North. A positive rotation is clockwise around the z-axis and specified in degrees from 0 to 360. Values above or below this range will be wrapped so that they fall within the range. For example, a value of -190 will be converted to 170. A value of 530 will be converted to 170 as well. |
roll | Type: numberDefault: 0Rotation about the y-axis. A positive rotation is clockwise around the y-axis and specified in degrees from 0 to 360. Values above or below this range will be wrapped so that they fall within the range. For example, a value of -190 will be converted to 170. A value of 530 will be converted to 170 as well. |
tilt | Type: numberDefault: 0Rotation about the x-axis. A positive rotation is clockwise around the x-axis and specified in degrees from 0 to 360. Values above or below this range will be wrapped so that they fall within the range. For example, a value of -190 will be converted to 170. A value of 530 will be converted to 170 as well. |
Methods | |
|---|---|
equals | equals(other)Parameters:
Return Value: boolean Whether the two objects are equal.Comparison function. |
toJSON | toJSON()Parameters: None Return Value: Orientation3DLiteralConverts to JSON representation. This function is intended to be used via JSON.stringify. |
Orientation3DLiteralinterface
google.maps.Orientation3DLiteralinterface
Object literals are accepted in place ofOrientation3D objects, as a convenience, in many places. These are converted toOrientation3D objects when the Maps API encounters them.
Properties | |
|---|---|
headingoptional | Type: numberoptionalRotation about the z-axis (normal to the Earth's surface). A value of 0 (the default) equals North. A positive rotation is clockwise around the z-axis and specified in degrees from 0 to 360. |
rolloptional | Type: numberoptionalRotation about the y-axis. A positive rotation is clockwise around the y-axis and specified in degrees from 0 to 360. |
tiltoptional | Type: numberoptionalRotation about the x-axis. A positive rotation is clockwise around the x-axis and specified in degrees from 0 to 360. |
Vector3Dclass
google.maps.Vector3Dclass
AVector3D is a three-dimensional vector used for standard mathematical operations such as scaling the bounds of three-dimensional object along local x-, y-, and z-axes.
- x is a real number.
- y is a real number.
- z is a real number.
This class implementsVector3DLiteral.
Access by callingconst {Vector3D} = await google.maps.importLibrary("core").
SeeLibraries in the Maps JavaScript API.
Constructor | |
|---|---|
Vector3D | Vector3D(value)Parameters:
|
Properties | |
|---|---|
x | Type: numberX-component of the three-dimensional vector. |
y | Type: numberY-component of the three-dimensional vector. |
z | Type: numberZ-component of the three-dimensional vector. |
Methods | |
|---|---|
equals | equals(other)Parameters:
Return Value: booleanComparison function. |
toJSON | toJSON()Parameters: None Return Value: Vector3DLiteralConverts to JSON representation. This function is intended to be used via JSON.stringify. |
Vector3DLiteralinterface
google.maps.Vector3DLiteralinterface
Object literals are accepted in place ofVector3D objects, as a convenience, in many places. These are converted toVector3D objects when the Maps API encounters them.
Properties | |
|---|---|
x | Type: numberX-component of the three-dimensional vector. |
y | Type: numberY-component of the three-dimensional vector. |
z | Type: numberZ-component of the three-dimensional vector. |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-11-21 UTC.