GoogleNavigation Framework Reference

  • Determines if a given point (CLLocationCoordinate2D) lies within a specified path.

  • The path is treated as closed, and the South Pole is always considered outside.

  • Paths can represent great circle segments (geodesic) or rhumb segments (non-geodesic).

  • Points exactly matching a vertex are considered inside; otherwise, points are either inside or outside, with no "on the border" condition.

  • Use GMSGeometryIsLocationOnPath() for border checks with tolerance.

GMSGeometryContainsLocation

extern BOOL GMSGeometryContainsLocation(CLLocationCoordinate2D point,
                                        GMSPath *_Nonnull path, BOOL geodesic)

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.