Functions
The following functions are available globally.
- 
                  
                  Projects coordinateto the map.coordinatemust be valid.DeclarationSwift func GMSProject(_ coordinate: CLLocationCoordinate2D) -> GMSMapPointObjective-C extern GMSMapPoint GMSProject(CLLocationCoordinate2D coordinate)
- 
                  
                  Unprojects pointfrom the map. point.x must be in [-1, 1].DeclarationSwift func GMSUnproject(_ point: GMSMapPoint) -> CLLocationCoordinate2DObjective-C extern CLLocationCoordinate2D GMSUnproject(GMSMapPoint point)
- 
                  
                  Returns a linearly interpolated point on the segment [a, b], at the fraction tfroma.t==0 corresponds toa,t==1 corresponds tob.The interpolation takes place along the short path between the points potentially crossing the date line. E.g. interpolating from San Francisco to Tokyo will pass north of Hawaii and cross the date line. DeclarationSwift func GMSMapPointInterpolate(_ a: GMSMapPoint, _ b: GMSMapPoint, _ t: Double) -> GMSMapPointObjective-C extern GMSMapPoint GMSMapPointInterpolate(GMSMapPoint a, GMSMapPoint b, double t)
- 
                  
                  Returns the length of the segment [a, b] in projected space. The length is computed along the short path between the points potentially crossing the date line. E.g. the distance between the points corresponding to San Francisco and Tokyo measures the segment that passes north of Hawaii crossing the date line. DeclarationSwift func GMSMapPointDistance(_ a: GMSMapPoint, _ b: GMSMapPoint) -> DoubleObjective-C extern double GMSMapPointDistance(GMSMapPoint a, GMSMapPoint b)
- 
                  
                  Returns whether pointlies inside of path. The path is always considered closed, regardless of whether the last point equals the first or not.Inside is defined as not containing the South Pole – the South Pole is always outside. pathdescribes great circle segments ifgeodesicis YES, and rhumb (loxodromic) segments otherwise.If pointis exactly equal to one of the vertices, the result is YES. A point that is not equal to a vertex is on one side or the other of any path segment – it can never be “exactly on the border”.See GMSGeometryIsLocationOnPath()for a border test with tolerance.
- 
                  
                  Returns whether pointlies on or nearpath, within the specifiedtolerancein meters.pathis composed of great circle segments ifgeodesicis YES, and of rhumb (loxodromic) segments ifgeodesicis NO.See also GMSGeometryIsLocationOnPath(point, path, geodesic).The tolerance, in meters, is relative to the spherical radius of the Earth. If you need to work on a sphere of different radius, you may compute the equivalent tolerance from the desired tolerance on the sphere of radius R: tolerance = toleranceR * (RadiusEarth / R), with RadiusEarth==6371009. DeclarationSwift func GMSGeometryIsLocationOnPathTolerance(_ point: CLLocationCoordinate2D, _ path: GMSPath, _ geodesic: Bool, _ tolerance: CLLocationDistance) -> BoolObjective-C extern BOOL GMSGeometryIsLocationOnPathTolerance(CLLocationCoordinate2D point, GMSPath *_Nonnull path, BOOL geodesic, CLLocationDistance tolerance)
- 
                  
                  Same as GMSGeometryIsLocationOnPath(point, path, geodesic, tolerance), with a default tolerance of 0.1 meters.
- 
                  
                  Returns the great circle distance between two coordinates, in meters, on Earth. This is the shortest distance between the two coordinates on the sphere. Both coordinates must be valid. DeclarationSwift func GMSGeometryDistance(_ from: CLLocationCoordinate2D, _ to: CLLocationCoordinate2D) -> CLLocationDistanceObjective-C extern CLLocationDistance GMSGeometryDistance(CLLocationCoordinate2D from, CLLocationCoordinate2D to)
- 
                  
                  Returns the great circle length of path, in meters, on Earth.This is the sum of GMSGeometryDistance()over the path segments.All the coordinates of the path must be valid. 
- 
                  
                  Returns the area of a geodesic polygon defined by pathon Earth.The “inside” of the polygon is defined as not containing the South pole. If pathis not closed, it is implicitly treated as a closed path nevertheless and the result is the same.All coordinates of the path must be valid. The polygon must be simple (not self-overlapping) and may be concave. If any segment of the path is a pair of antipodal points, the result is undefined – because two antipodal points do not form a unique great circle segment on the sphere. 
- 
                  
                  Returns the signed area of a geodesic polygon defined by pathon Earth.The result has the same absolute value as GMSGeometryArea(); it is positive if the points of path are in counter-clockwise order, and negative otherwise.The same restrictions as on GMSGeometryArea() apply. 
- 
                  
                  Returns the initial heading (degrees clockwise of North) at fromof the shortest path toto.The returned value is in the range [0, 360). Returns 0 if the two coordinates are the same. Both coordinates must be valid. To get the final heading at toone may use (GMSGeometryHeading(to,from) + 180) modulo 360.DeclarationSwift func GMSGeometryHeading(_ from: CLLocationCoordinate2D, _ to: CLLocationCoordinate2D) -> CLLocationDirectionObjective-C extern CLLocationDirection GMSGeometryHeading(CLLocationCoordinate2D from, CLLocationCoordinate2D to)
- 
                  
                  Returns the destination coordinate, when starting at fromwith initialheading, travellingdistancemeters along a great circle arc, on Earth.The resulting longitude is in the range [-180, 180). Both coordinates must be valid. DeclarationSwift func GMSGeometryOffset(_ from: CLLocationCoordinate2D, _ distance: CLLocationDistance, _ heading: CLLocationDirection) -> CLLocationCoordinate2DObjective-C extern CLLocationCoordinate2D GMSGeometryOffset(CLLocationCoordinate2D from, CLLocationDistance distance, CLLocationDirection heading)
- 
                  
                  Returns the coordinate that lies the given fractionof the way between thefromandtocoordinates on the shortest path between the two.The resulting longitude is in the range [-180, 180). DeclarationSwift func GMSGeometryInterpolate(_ from: CLLocationCoordinate2D, _ to: CLLocationCoordinate2D, _ fraction: Double) -> CLLocationCoordinate2DObjective-C extern CLLocationCoordinate2D GMSGeometryInterpolate(CLLocationCoordinate2D from, CLLocationCoordinate2D to, double fraction)
- 
                  
                  Returns an NSArrayofGMSStyleSpanconstructed by repeated application of style and length information fromstylesandlengthsalongpath.paththe path along which the output spans are computed.stylesanNSArrayof GMSStrokeStyle. Wraps if consumed. Can’t be empty.lengthsanNSArrayof NSNumber; each entry gives the length of the corresponding style fromstyles. Wraps if consumed. Can’t be empty.lengthKindthe interpretation of values fromlengths(geodesic, rhumb or projected).Example: a polyline with alternating black and white spans: GMSMutablePath*path;NSArray*styles = @[[GMSStrokeStylesolidColor:[UIColor whiteColor]], [GMSStrokeStylesolidColor:[UIColor blackColor]]];NSArray*lengths = @[@100000, @50000]; polyline.path = path; polyline.spans =GMSStyleSpans(path, styles, lengths, kGMSLengthRhumb);DeclarationSwift func GMSStyleSpans(_ path: GMSPath, _ styles: [GMSStrokeStyle], _ lengths: [NSNumber], _ lengthKind: GMSLengthKind) -> [GMSStyleSpan]Objective-C extern NSArray<GMSStyleSpan *> *_Nonnull GMSStyleSpans( GMSPath *_Nonnull path, NSArray<GMSStrokeStyle *> *_Nonnull styles, NSArray<NSNumber *> *_Nonnull lengths, GMSLengthKind lengthKind)
- 
                  
                  Similar to GMSStyleSpans(path, styles, lengths, lengthKind) but additionally takes an initial length offset that will be skipped over relative to the lengthsarray.lengthOffsetthe length (e.g. in meters) that should be skipped initially fromlengths.DeclarationSwift func GMSStyleSpansOffset(_ path: GMSPath, _ styles: [GMSStrokeStyle], _ lengths: [NSNumber], _ lengthKind: GMSLengthKind, _ lengthOffset: Double) -> [GMSStyleSpan]Objective-C extern NSArray<GMSStyleSpan *> *_Nonnull GMSStyleSpansOffset( GMSPath *_Nonnull path, NSArray<GMSStrokeStyle *> *_Nonnull styles, NSArray<NSNumber *> *_Nonnull lengths, GMSLengthKind lengthKind, double lengthOffset)
- 
                  
                  Calculates a hash value for the given string. Note The current implementation uses an MD5 hash, which is sufficient for uniquifying styles.DeclarationSwift func GMSStyleHashForString(_ string: String) -> UIntObjective-C extern NSUInteger GMSStyleHashForString(NSString *_Nonnull string)ParametersstringThe string to use to calculate the hash value. Return ValueThe hash value. 
- 
                  
                  Returns a GMSOrientationwith the givenheadingandpitch.@related GMSOrientationDeclarationSwift func GMSOrientationMake(_ heading: CLLocationDirection, _ pitch: Double) -> GMSOrientationObjective-C static inline GMSOrientation GMSOrientationMake(CLLocationDirection heading, double pitch)