2017-10-31 33 views
0

나는 버스 타르 팅 앱으로 작업 중입니다. GMSPath 클래스로 버스의 도로를 그립니다. 특정 경로 (위도, 경도)가 해당 경로에 있는지 확인해야합니다. 아니야. 내가 봤어,하지만 내가 원하는 것을 확인하기 위해 포함 (위도 : 경도)과 같은 방법을 찾을 수 없다. 나는 또한 보았다. google documentation 내가 어떻게이 일을 할 수 있는지 알고 있다면 나와 함께 경험을 공유하십시오.신속한 GMSPath 클래스의 contains (: 위도 : 경도) 메소드를 찾고 있습니다.

+0

가능한 복제 [GMS 마커가 내부에 있는지 확인하는 방법 GMSPolygon (아이폰 OS 구글지도 SDK)] (https://stackoverflow.com/questions/24826631/ gmsmarkoly-is-inside-of-gmspolygon-ios-google-map-sdk를 결정하는 방법) – Larme

답변

0

버스가 경로에서 약간 벗어날 수 있으므로 엄격한 봉쇄 대신 약간의 허용 오차를 추가해야 할 수도 있습니다. GMSGeometricUtils.h에서 살펴보고 더 구체적으로 :

/** 
* 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);