GoogleRidesharingConsumer Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMTSLatLng
Object representing the latitude and longitude.
-
Latitude associated with the object.
Declaration
Swift
var latitude: Double { get }
Objective-C
@property (nonatomic, readonly) double latitude;
-
Longitude associated with the object.
Declaration
Swift
var longitude: Double { get }
Objective-C
@property (nonatomic, readonly) double longitude;
-
Creates and returns an initialized GMTSLatLng
from given CLLocationCoordinate2D
.
Declaration
Swift
convenience init(from coordinate: CLLocationCoordinate2D)
Objective-C
+ (nonnull instancetype)latLngFromCoordinate:(CLLocationCoordinate2D)coordinate;
-
Initializes the object with the specified latitude
and `longitude’.
Declaration
Swift
init(latitude: Double, longitude: Double)
Objective-C
- (nonnull instancetype)initWithLatitude:(double)latitude
longitude:(double)longitude;
-
Declaration
Objective-C
- (nonnull instancetype)init;
-
Creates and returns a CLLocationCoordinate2D
from current GMTSLatLng
.
Declaration
Swift
func coordinate() -> CLLocationCoordinate2D
Objective-C
- (CLLocationCoordinate2D)coordinate;
-
Gets the lateral distance from the given latlng to the current location.
Declaration
Swift
func distance(fromLocation latlng: GMTSLatLng) -> CLLocationDistance
Objective-C
- (CLLocationDistance)distanceFromLocation:(nonnull GMTSLatLng *)latlng;
-
Declaration
Swift
func isAlmostEqual(_ latlng: GMTSLatLng?) -> Bool
Objective-C
- (BOOL)isAlmostEqual:(nullable GMTSLatLng *)latlng;
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 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMTSLatLng\u003c/code\u003e represents a latitude and longitude coordinate pair, offering methods to interact with location data.\u003c/p\u003e\n"],["\u003cp\u003eYou can initialize \u003ccode\u003eGMTSLatLng\u003c/code\u003e objects with a specific latitude and longitude or from an existing \u003ccode\u003eCLLocationCoordinate2D\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides read-only access to the latitude and longitude properties of a given location.\u003c/p\u003e\n"],["\u003cp\u003eIt allows calculating the lateral distance between two \u003ccode\u003eGMTSLatLng\u003c/code\u003e objects and provides a means to determine if two locations are almost equal within a defined tolerance.\u003c/p\u003e\n"],["\u003cp\u003eUse the \u003ccode\u003einitWithLatitude:longitude:\u003c/code\u003e method to initialize a \u003ccode\u003eGMTSLatLng\u003c/code\u003e instance, and avoid using the unavailable \u003ccode\u003einit\u003c/code\u003e method.\u003c/p\u003e\n"]]],[],null,["# GoogleRidesharingConsumer Framework Reference\n\nGMTSLatLng\n==========\n\n @interface GMTSLatLng : ../Classes/GMTCImmutableData.html\n\nObject representing the latitude and longitude.\n- `\n ``\n ``\n `\n\n ### [latitude](#/c:objc(cs)GMTSLatLng(py)latitude)\n\n `\n ` \n Latitude associated with the object. \n\n #### Declaration\n\n Swift \n\n var latitude: Double { get }\n\n Objective-C \n\n @property (nonatomic, readonly) double latitude;\n\n- `\n ``\n ``\n `\n\n ### [longitude](#/c:objc(cs)GMTSLatLng(py)longitude)\n\n `\n ` \n Longitude associated with the object. \n\n #### Declaration\n\n Swift \n\n var longitude: Double { get }\n\n Objective-C \n\n @property (nonatomic, readonly) double longitude;\n\n- `\n ``\n ``\n `\n\n ### [+latLngFromCoordinate:](#/c:objc(cs)GMTSLatLng(cm)latLngFromCoordinate:)\n\n `\n ` \n Creates and returns an initialized `GMTSLatLng` from given `CLLocationCoordinate2D`. \n\n #### Declaration\n\n Swift \n\n convenience init(from coordinate: CLLocationCoordinate2D)\n\n Objective-C \n\n + (nonnull instancetype)latLngFromCoordinate:(CLLocationCoordinate2D)coordinate;\n\n- `\n ``\n ``\n `\n\n ### [-initWithLatitude:longitude:](#/c:objc(cs)GMTSLatLng(im)initWithLatitude:longitude:)\n\n `\n ` \n Initializes the object with the specified [latitude](../Classes/GMTSLatLng.html#/c:objc(cs)GMTSLatLng(py)latitude) and \\`longitude'. \n\n #### Declaration\n\n Swift \n\n init(latitude: Double, longitude: Double)\n\n Objective-C \n\n - (nonnull instancetype)initWithLatitude:(double)latitude\n longitude:(double)longitude;\n\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)GMTSLatLng(im)init)\n\n `\n ` \n Unavailable \n @remark Use [-initWithLatitude:longitude:](../Classes/GMTSLatLng.html#/c:objc(cs)GMTSLatLng(im)initWithLatitude:longitude:). \n\n #### Declaration\n\n Objective-C \n\n - (nonnull instancetype)init;\n\n- `\n ``\n ``\n `\n\n ### [-coordinate](#/c:objc(cs)GMTSLatLng(im)coordinate)\n\n `\n ` \n Creates and returns a `CLLocationCoordinate2D` from current `GMTSLatLng`. \n\n #### Declaration\n\n Swift \n\n func coordinate() -\u003e CLLocationCoordinate2D\n\n Objective-C \n\n - (CLLocationCoordinate2D)coordinate;\n\n- `\n ``\n ``\n `\n\n ### [-distanceFromLocation:](#/c:objc(cs)GMTSLatLng(im)distanceFromLocation:)\n\n `\n ` \n Gets the lateral distance from the given latlng to the current location. \n\n #### Declaration\n\n Swift \n\n func distance(fromLocation latlng: GMTSLatLng) -\u003e CLLocationDistance\n\n Objective-C \n\n - (CLLocationDistance)distanceFromLocation:(nonnull GMTSLatLng *)latlng;\n\n- `\n ``\n ``\n `\n\n ### [-isAlmostEqual:](#/c:objc(cs)GMTSLatLng(im)isAlmostEqual:)\n\n `\n ` \n Indicates if the receiver is almost equal to another given `GMTSLatLng` object based on the\n constant, [GMTSLatLngDegreeAlmostEqualTolerance](../Constants/GMTSLatLngDegreeAlmostEqualTolerance.html). \n\n #### Declaration\n\n Swift \n\n func isAlmostEqual(_ latlng: GMTSLatLng?) -\u003e Bool\n\n Objective-C \n\n - (BOOL)isAlmostEqual:(nullable GMTSLatLng *)latlng;"]]