检查用户位置是否接近某些点 [英] Check if the user location is near of some points

查看:161
本文介绍了检查用户位置是否接近某些点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于GPS警报的问题。



我有一些点(经度和纬度)。我需要一种方法来检查用户位置是否接近这些点(大约是1800点)。



如果我没有记错的话,最好的做法是做这个:当GPS位置在某个区域时被通知。这可以优化电池。

你能给我什么建议吗? 每1800个不同的地区进行监测?

这是不可能的。请参阅此处



由于这个原因,核心位置限制为单个应用程序可能同时监视的区域数量。



如果您有超过20个区域需要监控,您可以这样做: -


  1. 当用户启动您的应用程序时,获取用户的位置并将位置发送到您的服务器
  2. 服务器获取用户位置后,收集N公里内的所有点(KM)半径。

  3. 如果N KM内的点数小于20,则将所有点发送给您的用户进行监控。

  4. 如果N KM超过20,你的服务器必须根据较小的半径减少点数(例如:N-1 KM)


    I我自己开发了一个区域监控应用程序,这就是我们所做的。


    I have a question about GPS alarm.

    I have some points (latitude and longitude). I need a way to check if the user location is near to some of these points (approximately are 1800 points).

    If I remember correctly there is a best practice to do this: to be notified when GPS position is in a certain region. This allows for optimizations regarding the battery.

    Can you give me any suggestions?

    解决方案

    1800 points as per 1800 different regions to be monitored?

    It is not possible. See here:

    For this reason, Core Location limits to 20 the number of regions that may be simultaneously monitored by a single app.

    If you have more than 20 regions to be monitored, this is what you can do:-

    1. When the user launches your app, get the user's location and send the location to your server
    2. After the server gets the user location, gathers all the points within N Kilometres (KM) radius.
    3. If the points within N KM are less than 20, then send all the points to your user to be monitored.
    4. If the points within N KM are more than 20, your server has to reduce the points based on the smaller radius (eg: N-1 KM)

    I have developed a region monitoring app myself and this is what we do.

    这篇关于检查用户位置是否接近某些点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆