【问题标题】:Simulate Low and Hight Gps Accuracy模拟低和高 Gps 精度
【发布时间】:2012-10-20 05:43:48
【问题描述】:

我做了一个.gpx文件来模拟IOS模拟器上的路线,现在我想模拟水平精度我该怎么做?

以下是我的 .gpx 文件的摘录:

<?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> 

如果我运行所有 gps 点返回 5 米的水平精度,否则我可以更改此设置。

【问题讨论】:

  • 没有模拟精度之类的东西 - 你从 GPS 获得读数,你的程序有责任知道要绘制的精度“圆”
  • @KevinDTimm 是的,我知道,因为这个责任我想尝试我的代码具有低精度和高精度,真的没有办法模拟水平精度吗?
  • 不,因为无论如何你收到的数据都是一样的。
  • @KevinDTimm 我理解,为我感到难过,但非常感谢凯文!
  • 同样的需求...

标签: gps ios-simulator emulation gpx


【解决方案1】:

我通过 viewController 的方法调用来做到这一点(我的是一个按钮,但显然你可以使用 gestureRecognizer 或其他什么)。

我的 viewController 设置为 LocationManagerDelegate,但您可以放入您正在使用的委托而不是“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];
}

【讨论】:

  • 智能解决方案!尽管在代码中,我们可以编写一个类来读取文件 gpx“或 json”并以这种方式发送信息!
猜你喜欢
  • 2016-02-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-05
  • 2020-08-06
相关资源
最近更新 更多