# Functions

The following functions are available globally.
- `


  ### [GMSGeometryContainsLocation](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSGeometryContainsLocation)


  ` Returns whether `point` lies 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.

  `path` describes great circle segments if `geodesic` is YES, and rhumb (loxodromic) segments
  otherwise.

  If `point` is 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.

  #### Declaration

  Swift

      func GMSGeometryContainsLocation(_ point: CLLocationCoordinate2D, _ path: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath, _ geodesic: Bool) -> Bool

  Objective-C

      extern BOOL GMSGeometryContainsLocation(CLLocationCoordinate2D point,
                                              https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath *_Nonnull path, BOOL geodesic)

- `


  ### [GMSGeometryIsLocationOnPathTolerance](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSGeometryIsLocationOnPathTolerance)


  ` Returns whether `point` lies on or near `path`, within the specified `tolerance` in meters.
  `path` is composed of great circle segments if `geodesic` is YES, and of rhumb (loxodromic)
  segments if `geodesic` is 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.

  #### Declaration

  Swift

      func GMSGeometryIsLocationOnPathTolerance(_ point: CLLocationCoordinate2D, _ path: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath, _ geodesic: Bool, _ tolerance: CLLocationDistance) -> Bool

  Objective-C

      extern BOOL GMSGeometryIsLocationOnPathTolerance(CLLocationCoordinate2D point,
                                                       https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath *_Nonnull path,
                                                       BOOL geodesic,
                                                       CLLocationDistance tolerance)

- `


  ### [GMSGeometryIsLocationOnPath](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSGeometryIsLocationOnPath)


  ` Same as `GMSGeometryIsLocationOnPath(point, path, geodesic, tolerance)`, with a default tolerance
  of 0.1 meters.

  #### Declaration

  Swift

      func GMSGeometryIsLocationOnPath(_ point: CLLocationCoordinate2D, _ path: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath, _ geodesic: Bool) -> Bool

  Objective-C

      extern BOOL GMSGeometryIsLocationOnPath(CLLocationCoordinate2D point,
                                              https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath *_Nonnull path, BOOL geodesic)

- `


  ### [GMSGeometryDistance](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSGeometryDistance)


  ` 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.

  #### Declaration

  Swift

      func GMSGeometryDistance(_ from: CLLocationCoordinate2D, _ to: CLLocationCoordinate2D) -> CLLocationDistance

  Objective-C

      extern CLLocationDistance GMSGeometryDistance(CLLocationCoordinate2D from,
                                                    CLLocationCoordinate2D to)

- `


  ### [GMSGeometryLength](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSGeometryLength)


  ` 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.

  #### Declaration

  Swift

      func GMSGeometryLength(_ path: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath) -> CLLocationDistance

  Objective-C

      extern CLLocationDistance GMSGeometryLength(https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath *_Nonnull path)

- `


  ### [GMSGeometryArea](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSGeometryArea)


  ` Returns the area of a geodesic polygon defined by `path` on Earth.

  The "inside" of the polygon is defined as not containing the South pole.

  If `path` is 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.

  #### Declaration

  Swift

      func GMSGeometryArea(_ path: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath) -> Double

  Objective-C

      extern double GMSGeometryArea(https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath *_Nonnull path)

- `


  ### [GMSGeometrySignedArea](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSGeometrySignedArea)


  ` Returns the signed area of a geodesic polygon defined by `path` on 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.

  #### Declaration

  Swift

      func GMSGeometrySignedArea(_ path: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath) -> Double

  Objective-C

      extern double GMSGeometrySignedArea(https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath *_Nonnull path)

- `


  ### [GMSGeometryHeading](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSGeometryHeading)


  ` Returns the initial heading (degrees clockwise of North) at `from` of the shortest path to `to`.

  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 `to` one may use (GMSGeometryHeading(`to`, `from`) + 180) modulo 360.

  #### Declaration

  Swift

      func GMSGeometryHeading(_ from: CLLocationCoordinate2D, _ to: CLLocationCoordinate2D) -> CLLocationDirection

  Objective-C

      extern CLLocationDirection GMSGeometryHeading(CLLocationCoordinate2D from,
                                                    CLLocationCoordinate2D to)

- `


  ### [GMSGeometryOffset](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSGeometryOffset)


  ` Returns the destination coordinate, when starting at `from` with initial `heading`, travelling
  `distance` meters along a great circle arc, on Earth.

  The resulting longitude is in the range \[-180, 180).

  Both coordinates must be valid.

  #### Declaration

  Swift

      func GMSGeometryOffset(_ from: CLLocationCoordinate2D, _ distance: CLLocationDistance, _ heading: CLLocationDirection) -> CLLocationCoordinate2D

  Objective-C

      extern CLLocationCoordinate2D GMSGeometryOffset(CLLocationCoordinate2D from,
                                                      CLLocationDistance distance,
                                                      CLLocationDirection heading)

- `


  ### [GMSGeometryInterpolate](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSGeometryInterpolate)


  ` Returns the coordinate that lies the given `fraction` of the way between the `from` and `to`
  coordinates on the shortest path between the two.

  The resulting longitude is in the range \[-180, 180).

  #### Declaration

  Swift

      func GMSGeometryInterpolate(_ from: CLLocationCoordinate2D, _ to: CLLocationCoordinate2D, _ fraction: Double) -> CLLocationCoordinate2D

  Objective-C

      extern CLLocationCoordinate2D
      GMSGeometryInterpolate(CLLocationCoordinate2D from, CLLocationCoordinate2D to,
                             double fraction)

- `


  ### [GMSProject](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSProject)


  ` Projects `coordinate` to the map. `coordinate` must be valid.

  #### Declaration

  Swift

      func GMSProject(_ coordinate: CLLocationCoordinate2D) -> https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint

  Objective-C

      extern https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint GMSProject(CLLocationCoordinate2D coordinate)

- `


  ### [GMSUnproject](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSUnproject)


  ` Unprojects `point` from the map. point.x must be in \[-1, 1\].

  #### Declaration

  Swift

      func GMSUnproject(_ point: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint) -> CLLocationCoordinate2D

  Objective-C

      extern CLLocationCoordinate2D GMSUnproject(https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint point)

- `


  ### [GMSMapPointInterpolate](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSMapPointInterpolate)


  ` Returns a linearly interpolated point on the segment \[a, b\], at the fraction `t` from `a`. `t`==0
  corresponds to `a`, `t`==1 corresponds to `b`.

  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.

  #### Declaration

  Swift

      func GMSMapPointInterpolate(_ a: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint, _ b: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint, _ t: Double) -> https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint

  Objective-C

      extern https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint GMSMapPointInterpolate(https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint a, https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint b,
                                                double t)

- `


  ### [GMSMapPointDistance](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSMapPointDistance)


  ` 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.

  #### Declaration

  Swift

      func GMSMapPointDistance(_ a: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint, _ b: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint) -> Double

  Objective-C

      extern double GMSMapPointDistance(https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint a, https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSMapPoint b)

- `


  ### [GMSStyleHashForString](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSStyleHashForString)


  ` Calculates a hash value for the given string.
  Note
  The current implementation uses an MD5 hash, which is sufficient for uniquifying styles.

  #### Declaration

  Swift

      func GMSStyleHashForString(_ string: String) -> UInt

  Objective-C

      extern NSUInteger GMSStyleHashForString(NSString *_Nonnull string)

  #### Parameters

  |---|---|
  | ` string ` | The string to use to calculate the hash value. |

  #### Return Value

  The hash value.
- `


  ### [GMSOrientationMake](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSOrientationMake)


  ` Returns a `https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSOrientation` with the given `heading` and `pitch`.

  @related `https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSOrientation`

  #### Declaration

  Swift

      func GMSOrientationMake(_ heading: CLLocationDirection, _ pitch: Double) -> https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSOrientation

  Objective-C

      static inline https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Structs/GMSOrientation GMSOrientationMake(CLLocationDirection heading,
                                                      double pitch)

- `


  ### [GMSStyleSpans](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSStyleSpans)


  ` Returns an `NSArray` of `https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStyleSpan` constructed by repeated application of style and length
  information from `styles` and `lengths` along `path`.

  `path` the path along which the output spans are computed.
  `styles` an `NSArray` of GMSStrokeStyle. Wraps if consumed. Can't be empty.
  `lengths` an `NSArray` of NSNumber; each entry gives the length of the corresponding
  style from `styles`. Wraps if consumed. Can't be empty.
  `lengthKind` the interpretation of values from `lengths` (geodesic, rhumb or projected).

  Example: a polyline with alternating black and white spans:

  <br />

       https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSMutablePath *path;
       NSArray *styles = @[[https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStrokeStyle solidColor:[UIColor whiteColor]],
                           [https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStrokeStyle solidColor:[UIColor blackColor]]];
       NSArray *lengths = @[@100000, @50000];
       polyline.path = path;
       polyline.spans = GMSStyleSpans(path, styles, lengths, kGMSLengthRhumb);
       
  <br />

  #### Declaration

  Swift

      func GMSStyleSpans(_ path: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath, _ styles: [https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStrokeStyle], _ lengths: [NSNumber], _ lengthKind: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Enums/GMSLengthKind) -> [https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStyleSpan]

  Objective-C

      extern NSArray<https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStyleSpan *> *_Nonnull GMSStyleSpans(
          https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath *_Nonnull path, NSArray<https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStrokeStyle *> *_Nonnull styles,
          NSArray<NSNumber *> *_Nonnull lengths, https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Enums/GMSLengthKind lengthKind)

- `


  ### [GMSStyleSpansOffset](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Functions/GMSStyleSpansOffset)


  ` Similar to GMSStyleSpans(path, styles, lengths, lengthKind) but additionally takes an initial
  length offset that will be skipped over relative to the `lengths` array.

  `lengthOffset` the length (e.g. in meters) that should be skipped initially from `lengths`.

  #### Declaration

  Swift

      func GMSStyleSpansOffset(_ path: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath, _ styles: [https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStrokeStyle], _ lengths: [NSNumber], _ lengthKind: https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Enums/GMSLengthKind, _ lengthOffset: Double) -> [https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStyleSpan]

  Objective-C

      extern NSArray<https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStyleSpan *> *_Nonnull GMSStyleSpansOffset(
          https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSPath *_Nonnull path, NSArray<https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSStrokeStyle *> *_Nonnull styles,
          NSArray<NSNumber *> *_Nonnull lengths, https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Enums/GMSLengthKind lengthKind,
          double lengthOffset)