LatLng
Stay organized with collections
Save and categorize content based on your preferences.
An immutable class representing a pair of latitude and longitude coordinates, stored as
degrees.
Inherited Constant Summary
From interface android.os.Parcelable
int |
CONTENTS_FILE_DESCRIPTOR |
|
int |
PARCELABLE_WRITE_RETURN_VALUE |
|
Public Constructor Summary
LatLng
(double latitude, double longitude) Constructs a LatLng with the given latitude and longitude, measured in degrees.
Inherited Method Summary
From class java.lang.Object
From interface android.os.Parcelable
abstract int |
describeContents
()
|
abstract void |
writeToParcel
( Parcel
arg0,
int arg1)
|
Fields
public final double
latitude
Latitude, in degrees. This value is in the range [-90, 90].
public final double
longitude
Longitude, in degrees. This value is in the range [-180, 180).
Public Constructors
public
LatLng
(double latitude, double
longitude)
Constructs a LatLng with the given latitude and longitude, measured in degrees.
Parameters
Public Methods
public boolean
equals
( Object
o)
Tests if this LatLng
is
equal to another.
Two points are considered equal if and only if their latitudes are bitwise equal and
their longitudes are bitwise equal. This means that two LatLng
s that are
very near, in terms of geometric distance, might not be considered .equal()
.
public void
writeToParcel
( Parcel
out, int
flags)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eLatLng\u003c/code\u003e is an immutable class that stores latitude and longitude coordinates in degrees.\u003c/p\u003e\n"],["\u003cp\u003eLatitude values range from -90 to +90 degrees, while longitude values range from -180 to +180 degrees.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides methods for constructing a \u003ccode\u003eLatLng\u003c/code\u003e object, checking equality, generating a hash code, converting to a string, and writing to a parcel.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLatLng\u003c/code\u003e objects are considered equal if and only if their latitudes and longitudes are bitwise equal.\u003c/p\u003e\n"]]],[],null,["# LatLng\n\npublic final class **LatLng** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nimplements [Parcelable](//developer.android.com/reference/android/os/Parcelable.html) [Parcelable](//developer.android.com/reference/android/os/Parcelable.html) \nAn immutable class representing a pair of latitude and longitude coordinates, stored as\ndegrees. \n\n### Inherited Constant Summary\n\nFrom interface android.os.Parcelable \n\n|-----|-------------------------------|---|\n| int | CONTENTS_FILE_DESCRIPTOR | |\n| int | PARCELABLE_WRITE_RETURN_VALUE | |\n\n### Field Summary\n\n|---------------------|------------------------------------------------------------------------------------|------------------------|\n| public final double | [latitude](/android/reference/com/google/android/gms/maps/model/LatLng#latitude) | Latitude, in degrees. |\n| public final double | [longitude](/android/reference/com/google/android/gms/maps/model/LatLng#longitude) | Longitude, in degrees. |\n\n### Public Constructor Summary\n\n|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [LatLng](/android/reference/com/google/android/gms/maps/model/LatLng#LatLng(double,%20double))(double latitude, double longitude) Constructs a LatLng with the given latitude and longitude, measured in degrees. |\n\n### Public Method Summary\n\n|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| boolean | [equals](/android/reference/com/google/android/gms/maps/model/LatLng#equals(java.lang.Object))([Object](//developer.android.com/reference/java/lang/Object.html) o) Tests if this [LatLng](/android/reference/com/google/android/gms/maps/model/LatLng) is equal to another. |\n| int | [hashCode](/android/reference/com/google/android/gms/maps/model/LatLng#hashCode())() |\n| [String](//developer.android.com/reference/java/lang/String.html) | [toString](/android/reference/com/google/android/gms/maps/model/LatLng#toString())() |\n| void | [writeToParcel](/android/reference/com/google/android/gms/maps/model/LatLng#writeToParcel(android.os.Parcel,%20int))([Parcel](//developer.android.com/reference/android/os/Parcel.html) out, int flags) |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface android.os.Parcelable \n\n|---------------|--------------------------------------------------------------------------------------------------|\n| abstract int | describeContents() |\n| abstract void | writeToParcel([Parcel](//developer.android.com/reference/android/os/Parcel.html) arg0, int arg1) |\n\nFields\n------\n\n#### public final double\n**latitude**\n\nLatitude, in degrees. This value is in the range \\[-90, 90\\]. \n\n#### public final double\n**longitude**\n\nLongitude, in degrees. This value is in the range \\[-180, 180).\n\nPublic Constructors\n-------------------\n\n#### public **LatLng** (double latitude, double longitude)\n\nConstructs a LatLng with the given latitude and longitude, measured in degrees. \n\n##### Parameters\n\n| latitude | The point's latitude. This will be clamped to between -90 degrees and +90 degrees inclusive. |\n| longitude | The point's longitude. This will be normalized to be within -180 degrees inclusive and +180 degrees exclusive. |\n|-----------|----------------------------------------------------------------------------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public boolean **equals** ([Object](//developer.android.com/reference/java/lang/Object.html) o)\n\nTests if this [LatLng](/android/reference/com/google/android/gms/maps/model/LatLng) is\nequal to another.\n\nTwo points are considered equal if and only if their latitudes are bitwise equal and\ntheir longitudes are bitwise equal. This means that two `LatLng`s that are\nvery near, in terms of geometric distance, might not be considered\n`.equal()`. \n\n#### public int **hashCode** ()\n\n#### public [String](//developer.android.com/reference/java/lang/String.html) **toString** ()\n\n#### public void **writeToParcel** ([Parcel](//developer.android.com/reference/android/os/Parcel.html) out, int flags)"]]