# GoogleNavigation Framework Reference

# GMSPath

    @interface GMSPath : NSObject <NSCopying, NSMutableCopying>

`GMSPath` encapsulates an immutable array of `CLLocationCooordinate2D`. All the coordinates of a
`GMSPath` must be valid. The mutable counterpart is `https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSMutablePath.html`.
- `


  ### [+path](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath#/c:objc(cs)GMSPath(cm)path)


  ` Convenience constructor for an empty path.

  #### Declaration

  Objective-C

      + (nonnull instancetype)path;

- `


  ### [-initWithPath:](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath#/c:objc(cs)GMSPath(im)initWithPath:)


  ` Initializes a newly allocated path with the contents of another `GMSPath`.

  #### Declaration

  Swift

      init(path: GMSPath)

  Objective-C

      - (nonnull id)initWithPath:(nonnull GMSPath *)path;

- `


  ### [-count](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath#/c:objc(cs)GMSPath(im)count)


  ` Get size of path.

  #### Declaration

  Swift

      func count() -> UInt

  Objective-C

      - (NSUInteger)count;

- `


  ### [-coordinateAtIndex:](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath#/c:objc(cs)GMSPath(im)coordinateAtIndex:)


  ` Returns `kCLLocationCoordinate2DInvalid` if `index` \>= count.

  #### Declaration

  Swift

      func coordinate(at index: UInt) -> CLLocationCoordinate2D

  Objective-C

      - (CLLocationCoordinate2D)coordinateAtIndex:(NSUInteger)index;

- `


  ### [+pathFromEncodedPath:](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath#/c:objc(cs)GMSPath(cm)pathFromEncodedPath:)


  ` Initializes a newly allocated path from `https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath.html#/c:objc(cs)GMSPath(im)encodedPath`. This format is described at:
  <https://developers.google.com/maps/documentation/utilities/polylinealgorithm>

  #### Declaration

  Swift

      convenience init?(fromEncodedPath encodedPath: String)

  Objective-C

      + (nullable instancetype)pathFromEncodedPath:(nonnull NSString *)encodedPath;

- `


  ### [-encodedPath](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath#/c:objc(cs)GMSPath(im)encodedPath)


  ` Returns an encoded string of the path in the format described above.

  #### Declaration

  Swift

      func encodedPath() -> String

  Objective-C

      - (nonnull NSString *)encodedPath;

- `


  ### [-pathOffsetByLatitude:longitude:](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath#/c:objc(cs)GMSPath(im)pathOffsetByLatitude:longitude:)


  ` Returns a new path obtained by adding `deltaLatitude` and `deltaLongitude` to each coordinate
  of the current path. Does not modify the current path.

  #### Declaration

  Swift

      func pathOffset(byLatitude deltaLatitude: CLLocationDegrees, longitude deltaLongitude: CLLocationDegrees) -> Self

  Objective-C

      - (nonnull instancetype)pathOffsetByLatitude:(CLLocationDegrees)deltaLatitude
                                         longitude:(CLLocationDegrees)deltaLongitude;

[## GMSPathLength](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath#/GMSPathLength)

- `


  ### [-segmentsForLength:kind:](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath#/c:objc(cs)GMSPath(im)segmentsForLength:kind:)


  ` Returns the fractional number of segments along the path that correspond to `length`,
  interpreted according to `kind`. See `https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Enums/GMSLengthKind.html`.

  #### Declaration

  Swift

      func segments(forLength length: CLLocationDistance, kind: https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Enums/GMSLengthKind.html) -> Double

  Objective-C

      - (double)segmentsForLength:(CLLocationDistance)length kind:(https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Enums/GMSLengthKind.html)kind;

- `


  ### [-lengthOfKind:](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSPath#/c:objc(cs)GMSPath(im)lengthOfKind:)


  ` Returns the length of the path, according to `kind`. See `https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Enums/GMSLengthKind.html`.

  #### Declaration

  Swift

      func length(of kind: https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Enums/GMSLengthKind.html) -> CLLocationDistance

  Objective-C

      - (CLLocationDistance)lengthOfKind:(https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Enums/GMSLengthKind.html)kind;