好吧,这是我的问题。我正在使用的系统使用名为“区域”的对象来表示地图上的 920x920 米区域。然而,为“区域”提供的唯一参考是网格方块左上角的纬度和经度。
我需要做的是确定用户当前的 GPS 位置是否落在特定区域内,因此我正在编写一个函数来检查是否属于这种情况,如果是,则从该区域对象返回数据。
我正在努力的地方实际上是找出进行位置检查的最佳方法,而我所要做的就是用户的确切纬度/经度以及网格正方形左上角的已知纬度/经度......什么是解决这个问题的最佳方法吗?
非常感谢您的帮助。
Okay, here's my problem. The system I'm working with uses objects called Areas to represent a 920x920 metre area on a map. The only reference given for the Area, however, is the latitude and longitude for the top-left corner of the grid square.
What I need to do is work out whether the user's current GPS location falls within a specific area, so I'm writing a function that checks if this is the case, and if so returns data from that area object.
Where I'm struggling is actually working out the best way to do the location checking, when all I have to go on is the user's exact lat/long and a known lat/long for the top left of the grid square...what would be the best way to approach this problem?
Many thanks for any help.
发布评论
评论(1)
第 1 步:将这些计算(或等效内容)移植到 Java 中,并使用它们来确定有多少给定坐标的纬度或经度 920 米
步骤 #2:使用步骤 #1 中的值确定正方形右下角的纬度/经度坐标
步骤 #3:查看用户的经度是否在左值和右值,以及如果用户的纬度位于顶部值和底部值之间
。在到达关键拐点(0 度纬度、+/-180 度纬度等)时请务必小心。
Step #1: Port these calculations (or the equivalent) to Java and use them to determine how many degrees of latitude or longitude 920 meters is given your coordinates
Step #2: Use the values from Step #1 to determine the latitude/longitude coordinates of the lower-right corner of your square
Step #3: See if the user's longitude is between the left and right values, and if the user's latitude is between the top and bottom values
Just be careful as you get to the key inflection points (0 degrees latitude, +/-180 degrees latitude, etc.).