简体   繁体   English

如何在给定时间在大表中查找GPS坐标的接近值

[英]How to find close GPS co-ordinates in large table at a given time

(This is a theoretical question for a system design I am working on - advising changes is great) I have a large table of GPS data which contains the following rows: (这是我正在研究的系统设计的理论问题-建议进行很大的更改)我有一个很大的GPS数据表,其中包含以下行:

  • locID - PK locID-PK
  • userID - User ID of the user of the app userID-应用程序用户的用户ID
  • lat LAT
  • long
  • timestamp - point in UNIX time when this data was recorded timestamp-记录此数据的UNIX时间点

I am trying to design a way which will allow a server to go through this dataset and check if any "users" were in a specific "place" together (eg. 50m apart) at a specific time range (2min) - eg. 我正在尝试设计一种方法,该方法将允许服务器浏览此数据集,并检查在特定时间范围(例如2分钟)内(例如相隔50m)是否有任何“用户”在一起(例如相隔50m)。 did user1 visit the same vicinity of user2 within that 2min time gap. 在此2分钟的时间间隔内,user1是否访问过user2的同一地区。

The only way I can currently think of is check each row one by one with all the rows in the same timeframe using a co-ordinate distance check algorithm. 我目前唯一想到的方法是使用坐标距离检查算法在同一时间范围内逐行检查所有行。 - But this comes up with the issue if the users are all around the world and have thousands maybe millions of rows in that 5min timeframe this would not work efficiently. -但是,如果用户遍布世界各地,并且在5分钟内有成千上万的行,这将无法有效地解决问题。

Also what if I want to know how long they were in each others vicinity? 如果我想知道他们在彼此附近多久了怎么办?

Any ideas/thoughts would be helpful. 任何想法/想法都会有所帮助。 Including the database to use? 包括数据库要用吗? I am thinking either PostgreSQL or maybe Cassandra. 我在考虑PostgreSQL或Cassandra。 And the table layout. 和表的布局。 All help appreciated. 所有帮助表示赞赏。

Divide the globe into patches, where each patch is small enough to contain only a few thousand people, say 200m by 200m, and add the patchID as an attribute to each entry in the database. 将地球仪分成多个补丁,每个补丁足够小,只能容纳数千人,例如200m x 200m,然后将patchID作为属性添加到数据库中的每个条目。 Note that two users cannot be in close proximity if they aren't in the same patch or in adjacent patches. 请注意,如果两个用户不在同一补丁程序中或不在相邻补丁程序中,则它们不能紧邻。 Therefore, when checking for two users in the same place at a given time, query the database for a given patchID and the eight surrounding patchIDs , to get a subset of the database that may contain possible collisions. 因此,在给定时间在同一位置检查两个用户时,请在数据库中查询给定的patchID和八个周围的patchIDs ,以获取可能包含冲突的数据库子集。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从坐标列表中计算到给定点的最近坐标 - How to calculate the closest co-ordinates to a given point from a list of co-ordinates 如何将这些GPS坐标转换为有效的Google Maps坐标? - How to convert these GPS co-ordinates into valid Google Maps cordinates? 给定2-D平面中n个点的坐标,找出形成直角三角形的三元组的数量 - Given the co-ordinates of n points in 2-D plane, find the number of triplets that form right triangle 给定随机纬度/经度,从给定隐含行进方向的坐标列表中找到最接近的坐标(纬度/经度) - Given a random lat/lon, find nearest co-ordinate(lat/lon) from given the list of co-ordinates implying the direction of traveling 如何从服务器端的客户端计算到给定点的最接近坐标 - How to calculate the closest co-ordinates to a given point from a client on server side 如何找到在二维平面上连接一组坐标的最小生成树? - How to find minimum spanning tree connecting a set of co-ordinates in the 2d plane? 如何从可以平移或旋转的四个点找到一个点的坐标? 所有这些点形成一个僵硬的身体 - How to find co-ordinates of a point from four points that can translate or rotate? All these points form a rigid body 给定定义形状的坐标,是否有任何算法可以计算形状的面积? - Is there any algorithm for calculating area of a shape given co-ordinates that define the shape? 从坐标到坐标的可能路径 - Possible Path from to Co-ordinates 二维最接近坐标的算法 - Algorithm for 2-D closest co-ordinates
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM