什么是更好的方式表示空间数据 [英] What is better way represent a spatial data

查看:119
本文介绍了什么是更好的方式表示空间数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的系统中有以下问题:
我的系统是客户端 - 服务器架构。我的应用是关于在一个城市的识别建筑。我决定将城市的地图分成网格每个网格的面积等于30×30米。对于每个网格区域i存储网格的中心点(lat,long)。 所以我的问题是如果用户位于特定的网格x
它的位置是发送到服务器如何我可以决定在用户​​所在的网格

I have the following problem in my system : my system is client-server architectural . my application is about recognition building in a city .so i decide to separate the map of the city into grids each grid has an area equal 30 x 30 m . for each grid region i store the center point of the grid (lat,long) . so my question is if a user is located in a specific grid x it's location are send to the server how i can decide in which grid the user are located ?

这张照片说明了问题:

推荐答案

我假设您的网格尺寸完全相同,在一个完美的矩形,如你的形象所示。如何将所有网格存储在一个简单的2D数组?然后,您可以通过执行

I'm assuming your grids are all exactly the same size, and are arranged in a perfect rectangle, as indicated by your image. How about storing all grids in a simple 2D array? You can then find the index of any grid by doing

grid_size = 30; 
index_x = math.floor(user.x/grid_size); 
index_y = math.floor(user.y/grid_size);

这篇关于什么是更好的方式表示空间数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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