两个用户在水平精度和视野范围内的交叉概率
我正在从 GPS 接收数据并将它们存储在 MySQL 数据库中。我有以下列:
User ID (int) Latitude (double) Longitude (double) Horizontal Accuracy (double)
水平精度是纬度/经度周围的半径,因此我的用户具有相同的概率可以位于该区域的任何点。
我需要找出两个用户相交的概率。但我也有视野,有30米。如果水平精度为 0,我可以只测量绕纬度/经度半径为 30 米的两个圆的相交面积。但就我而言,这是不可能的,因为水平精度可能在 5 到 3000 的范围内。通常它超出了我的视野范围。
我想我可以测量两个圆锥体的相交面积,其中该圆锥体的内圆半径为水平精度+ 30米,外圆半径为水平精度。但这个解决方案似乎有点复杂。
我想听听对此以及其他可能的解决方案的一些想法。
我已经检查了 MySQL Spatial 扩展,据我所知它无法为我做这样的计算。
谢谢。
I'm receiving data from GPS and store them in MySQL database. I have following columns:
User ID (int) Latitude (double) Longitude (double) Horizontal Accuracy (double)
Horizontal accuracy is radius around Lat/Long, so my user with equivalent probability can be in any point of this area.
I need to find out probability that two users was intersecting. But I also have vision area, which is 30 meters. If horizontal accuracy would be 0 I could just measure area of intersection of two circles that have radius of 30 meters around lat/long. But in my case that's not possible because horizontal accuracy could be in range from 5 to 3000. Usually it's more than my vision area.
I think I can measure area of intersection of two cones where inner circle of this cone will have radius of horizontal accuracy + 30 meters and outer circle will have radius of horizontal accuracy. But this solution seems to be little bit complicated.
I want to hear some thoughts about that and other possible solution.
I've checked MySQL Spatial extension and as far I can see it can't do such calculations for me.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我正在研究你所描述的这样的问题。我的方法是将纬度/经度(世界坐标)转换为 X/Y(笛卡尔坐标),然后应用毕达哥拉斯定理 a^2 + b^2 = c^2 来解决问题。
首先,您需要转换纬度/经度坐标。
要获得 X,请将半径乘以角度的余弦 (cos)(注意:该角度必须表示为弧度)。
要获得 Y,请执行与上述相同的操作,但使用正弦函数 (sin)。
将角度转换为半径 将角度乘以 PI 的数量(约 3.14159...)/ 180。
弧度 = 角度 * (PI / 180);
求解 c^2“C 平方” c = SQRT (a*a + b*b);
有关角度到弧度的更多信息:http://www.mathwarehouse .com/trigonometry/radians/convert-degee-to-radians.php
有关以下内容的更多信息:将纬度/经度转换为 X/Y 坐标:http://www.mathsisfun.com/polar-cartesian-coordinates.html
我通常通过在ask.com 上提问来找到解决此类问题所需的信息。
一切顺利。
艾伦
I worked on just such a problem as you are describing. How I approached it was to convert the Lat/Long (world coordinates) into X/Y (Cartesian coordinates) then I applied the Pythagorean Theorem a^2 + b^2 = c^2 to solve the problem.
First you need to convert the Lat/Long Coordinates.
To get X you Multiply the Radius by the cosine (cos) of the angle (NOTE: this angle has to be expressed as radians).
To get Y you do the same as above but use the sine function (sin).
To convert degrees to radials Multiply the angle by the quantity of PI (Approx. 3.14159...) / 180.
Radians = Angle * (PI / 180);
To solve for the c^2 "C Squared" c = SQRT (a*a + b*b);
For more information on Degrees to Radians: http://www.mathwarehouse.com/trigonometry/radians/convert-degee-to-radians.php
For more information on: Converting Lat/Long to X/Y coordinates: http://www.mathsisfun.com/polar-cartesian-coordinates.html
I usually find the information that I need for this kind of problem by asking a question on ask.com.
All the best.
Allan