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 395 times
-1
![](../../users/profiles/1238965.webp)
MrUpsidown
- 19,965
- 12
- 63
- 114
![](../../users/profiles/3802053.webp)
Vusala Hasanli
- 380
- 1
- 6
- 19
-
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);
![](../../users/profiles/3242049.webp)
stakri
- 1,249
- 1
- 8
- 13