iOS查找其他附近设备(GPS位置) [英] iOS Find Other Nearby Devices (GPS locations)

查看:128
本文介绍了iOS查找其他附近设备(GPS位置)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个允许用户将其位置传输到服务器的应用程序。我想要做的是让用户按下一个按钮,该按钮将向应用程序内的任何人发送推送通知,例如半径3英里。有人能给我一个如何实现这一目标的概述。

I have an app that allows a user to transmit their location to a server. What I am trying to do is have the user press a button that will send a push notification to anyone with the app within lets say a 3 mile radius. Can someone give me an overview of how I can accomplish this.

我能想到的唯一方法就是将gps coords发布到服务器上。然后当用户按下发送通知时,消息被发送到服务器,然后服务器根据位置进行一些复杂的邻近搜索,然后将值返回给用户。

The only way I could think of doing this is publishing the gps coords to a server. Then when the user presses "Send notif" a message gets sent to the server, then the server does some complex proximity search based upon the location and then returns the values to the user.

我的问题是,我没有服务器端的经验,也不知道如何在服务器上编写GPS搜索算法。

My problem is, I have no server-side experience and have no idea how to program a GPS search algorithm on the server.

我是否有办法在不必在服务器上编写代码的情况下做我想做的事情?我可以使用 Parse 来存储GPS坐标。我想保留我的服务器代码,只需存储和检索值,并处理客户端的其他任何事情。

Is there a way for me to do what I want without having to write code on a server? I am able to use Parse to store the GPS coordinates. I'd like to keep my server code to simply storing and retrieving values and handle everything else client side.

想法?

推荐答案

每个设备都应该发送他们的GPS坐标服务器定期。我想你已经迈出了这一步。下一步是找到彼此靠近的设备。这很简单。

Each device should send their GPS coordinates to the server periodically. I think you already have this step. The next step is to find devices that are near each other. This is fairly simple.

两个纬度和经度点之间的距离

但是,如果你有数百万台设备,那将是一个规模问题如果您将每个更新与所有其他设备进行比较。您可以将设备存储到某个区域。例如,您可以将更新存储在100平方英里的区域中。当更新进入时,您只需要比较该存储桶中的那些设备以及相邻存储桶(如果它们位于边缘附近)。这只是头部分析的顶部,但希望它会指向正确的方向。

However, if you have millions of devices, it will be a problem of scale if you compare each update to all the other devices. You might bucket the devices to a certain area. For example, you might bucket the updates into 100 square mile areas. When an update comes in you need to only compare to those devies in that bucket plus adjacent buckets if they are near the edge. This is just top of the head analysis but hopefully it will point you in the right direction.

这篇关于iOS查找其他附近设备(GPS位置)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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