如何非常有效地将纬度/经度分配给形状描述的城市边界?
我有一个巨大的 shapefile,包含 36.000 个不重叠的多边形(城市边界)。我想轻松确定给定纬度/经度所属的多边形。考虑到它必须具有极高的计算效率,最好的方法是什么?
我正在考虑创建一个查找表(tilex,tiley,polygone_id),其中tilex和tiley是缩放级别21或22的图块标识符。是的,使用图块编号和平面投影的精度缺乏在我的应用程序中是可以接受的。
我宁愿不使用 postgres 的 GIS 扩展,并且可以使用一个运行 2 天来生成所有 INSERT 语句的程序。
I have a huge shapefile of 36.000 non-overlapping polygones (city boundaries). I want to easily determine the polygone into which a given lat/long falls. What would the best way given that it must be extremely computationaly efficient ?
I was thinking of creating a lookup table (tilex,tiley,polygone_id) where tilex and tiley are tile identifiers at zoom levels 21 or 22. Yes, the lack of precision of using tile numbers and a planar projection is acceptable in my application.
I would rather not use postgres's GIS extension and am fine with a program that will run for 2 days to generate all the INSERT statements.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将语句插入什么?您是否使用不同的空间数据库或其他数据库?如果您愿意使用 python、C 或 Java,您可以使用 shapely、GEOS 或 JTS 编写一些自定义代码来相当简单地完成您想要的操作。
在Python中使用这个lib来打开shapefile
http://indiemaps.com/blog/2008/03 /easy-shapefile-loading-in-python/
然后是 shapely
http://gispython.org/shapely/docs/1.0/manual.html#包含
测试遏制
对于 Java,请使用 Geotools,其中还包括 JTS。
Insert statements into what? Are you using a different spatial database or some other database? If you are willing to use python, C, or Java you could use shapely, GEOS, or JTS to write some custom code to do what you want rather simply.
In python use this lib to open the shapefile
http://indiemaps.com/blog/2008/03/easy-shapefile-loading-in-python/
then shapely
http://gispython.org/shapely/docs/1.0/manual.html#contains
to test containment
For Java use Geotools which also includes JTS.
听起来您想要一个 BSP 树。基本上,您可以像树一样将区域分成越来越小的多边形。
优点是您不需要稍后与每个多边形比较坐标。这使得它成为找到正确多边形的非常快速的方法。
Sounds like you want a BSP tree. Basically you divide the area into smaller and smaller polygons in a tree like fashion.
The advantage is that you don't need to compare coordinates with every polygon later on. That makes it a very fast way to find the correct polygon.