mapbox-maps-ios icon indicating copy to clipboard operation
mapbox-maps-ios copied to clipboard

How to improve accuracy

Open zp18862956943 opened this issue 2 years ago • 0 comments

At present, people are in China and have opened a vpn. By adding a LocationConsumer to mapview, they can obtain location information and draw a route in func locationUpdate(newLocation: Location). The question now is how to improve the accuracy?

  • Xcode version: 14.0 beat2

  • iOS version: 16.0 beat3

  • Devices affected:

  • Maps SDK Version: 10.6.1

      var option = LocationOptions()
      option.puckBearingEnabled = true
      option.puckType = .puck2D(Puck2DConfiguration.makeDefault(showBearing: true))
      option.distanceFilter = kCLDistanceFilterNone
      option.activityType = .other
      option.desiredAccuracy = kCLLocationAccuracyBest
      mapView.location.options = option
      mapView.location.delegate = self
      cameraLocationConsumer = CameraLocationConsumer(mapView: mapView)
      mapView.mapboxMap.onNext(.mapLoaded) { _ in
          self.mapView.location.addLocationConsumer(newConsumer: self.cameraLocationConsumer)
      }
    

    func locationUpdate(newLocation: Location) {

    if  newLocation.location.horizontalAccuracy < 0 || newLocation.location.verticalAccuracy < 0   ||
          newLocation.location.speedAccuracy < 0
      {
          return
      }
    
    
      //do something
      XXXXX
    

}

zp18862956943 avatar Jul 28 '22 10:07 zp18862956943