我正在按位置移动和旋转自行车标记,一切正常。
问题是在进行跟踪时,bikeMarker有时显示在道路上,有时显示在道路外,这为什么会发生?
我只想在道路上显示bikeMarker
是否使用了其他任何google api
来解决此问题,然后建议我。代码在Swift 3.0
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
self.bikeMarker.position = CLLocationCoordinate2DMake((locations.last?.coordinate.latitude)!, (locations.last?.coordinate.longitude)!)
self.bikeMarker.icon = UIImage(named: "ic_bikeTracking.png")
self.bikeMarker.rotation = locationManager.location?.course ?? 0
self.bikeMarker.map = self.view_GMSmapview
self.view_GMSmapview.camera = GMSCameraPosition.camera(withTarget: (locations.last?.coordinate)!, zoom: self.mapZoom)
}