4

I did a .gpx file to simulate a route on IOS simulator, now i wanna simulate the horizontal accuracy how I can do this?

as follow is an excerpt of my .gpx file:

<?xml version="1.0"?>
<gpx>
    <wpt lat="-23.772830" lon="-46.689820"/> //how add horizontal accuracy 7 meters for example
    <wpt lat="-23.774450" lon="-46.692570"/> //and here horizontal accuracy of 2 metters for example
    <wpt lat="-23.773450" lon="-46.693530"/> //and here 19 meters
</gpx> 

if I run all gps points return horizontal accuracy of 5 meters, I can change this otherwise.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
ademar111190
  • 14,215
  • 14
  • 85
  • 114

1 Answers1

5

I did this with a method call from the viewController (mine is a button, but obviously you could use a gestureRecognizer or whatever).

I have my viewController set as the LocationManagerDelegate, but you can put in the delegate you're using instead of "self"

- (IBAction)simulateAccuracy:(id)sender {
    CLLocationCoordinate2D newCoor = CLLocationCoordinate2DMake(someLat, someLng);
    CLLocation *newLoc = [[CLLocation alloc]    initWithCoordinate:newCoor altitude:someAlt
    horizontalAccuracy:TheAccuracyYouWantToTest verticalAccuracy:ditto timestamp:nil];
    NSArray *newLocation = [[NSArray alloc] initWithObjects:newLoc,nil];
    [self locationManager:myLocationManager didUpdateLocations:newLocation];
}
jrwalt4
  • 66
  • 1
  • 4
  • smart solution! despite being in code, we can write a class to read the file gpx "or a json" and send the information in this way! – ademar111190 Feb 18 '13 at 11:07