显示 100 公里左右的图钉
我正在实现一个应用程序,可以在地图上显示客户和我的用户位置。 但现在我遇到了一个问题,因为顾客很多,而且地图很不舒服。
我如何只能在地图或列表中看到距离 100 公里左右的图钉 我?
我希望有人能帮助我?
问候马可
i am implementing an app, that show customers and my userLocation on a map.
But now i have a problem, because there are a lot of costumers and the map is very uncomfortable.
How can i only see pins on a map or in a list, that are around 100 kilometers away from
me?
I hope someone could help me?
Greetings Marco
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将当前位置缓存在 CLLocation* 变量中。
您必须使用 [myLoc getDistanceFrom:pinLoc] 计算从该位置添加的每个引脚(注释)的距离,我相信它会返回 CLLocationDistance。如果这是> 100 公里不要将其添加到您的地图中。
you should cache your current location in a CLLocation* variable.
You have to calculate the distance of every pin (annotation) you add from this location using [myLoc getDistanceFrom:pinLoc] which returns a CLLocationDistance i believe. If this is > 100 kms don't add it to your map.