I am working on bus tarcking app.I draw road of bus with GMSPath class.I need to check specific (latitude,longitude) is in that path or not.I googled,but cannot find method like contain(:latitude:longitude) for checking what I want.I also looked google documentation Please if you know anything about how I can do this,share your experience with me.
Asked
Active
Viewed 513 times
-1

MrUpsidown
- 21,592
- 15
- 77
- 131

Vusala Hasanli
- 409
- 2
- 7
- 21
-
Possible duplicate of [How to determine if an GMSMarker is inside of GMSPolygon (iOS Google Map SDK)](https://stackoverflow.com/questions/24826631/how-to-determine-if-an-gmsmarker-is-inside-of-gmspolygon-ios-google-map-sdk) – Larme Oct 31 '17 at 12:39
1 Answers
0
The bus might slightly be off path, so you might need to add some tolerance instead of strict containment. Have a look at GMSGeometricUtils.h
and more specifically at:
/**
* 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.
*
*/
BOOL GMSGeometryIsLocationOnPathTolerance(CLLocationCoordinate2D point,
GMSPath *path,
BOOL geodesic,
CLLocationDistance tolerance);

stakri
- 1,357
- 1
- 11
- 14