PostGIS、Postgres、地理编码...
我希望能够执行以下操作:
选择一个多边形和一个点,然后查看该点是否位于多边形内...我以为我可以使用 MySQL 来做到这一点,但经过一整天的研究,这是根本不可能的。
我已经看到我需要使用 postgres 和 postgis,我以前从未使用过 postgres。
我已经成功安装了 postgres 和 postpgadmin,看起来我已经创建了一个数据库并启动并运行了它。现在我显然需要将 postgis 添加到数据库才能使用这些功能?它们不只是 postgres 库的一部分吗?为什么人们说我需要将表添加到数据库才能使用这些功能?
如何将 postgis 添加到我的数据库?
谁能给我任何简单清晰的查询示例来查看一个点是否在多边形中?
I want to be able to do the following:
Select a Polygon and a point and see if the point lies within the polygon...I thought I could do this with MySQL but after a whole day of research it is simply not possible.
I have seen I need to use postgres and postgis, I have never used postgres before.
I have managed to install postgres and postpgadmin and it looks like I have created a database and got it up and running. Now I apparently need to add postgis to the database in order to use the functions? arent they just part of the postgres library? and why are people saying I need to add tables to the database to use the functions?
How do I add postgis to my database?
Can anyone give me any simple clear examples of a query to see if a point is in a polygon?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于纯粹的几何查询,您不需要 postgis。当你想要处理地理数据时就需要 Postgis。
作为检查一个点是否在多边形内部的示例,此查询应该让您清楚:
这将打印 true,这意味着由点 (0,0)、(1,1) 和 (1, 0) 包含点 (.5, .5)。
有关更多信息,请检查:http://www.postgresql.org/docs/ 9.0/interactive/datatype-geometric.html 和 http://www.postgresql.org/docs/9.0/interactive/functions-geometry.html
For purely geometrical queries you won't need postgis. Postgis is required when you want to mess with geographical data.
For an example of checking if a point is inside a polygon, this query should make it clear to you:
This will print true, meaning that the triangle formed by the points (0,0), (1,1) and (1,0) contains the point (.5, .5).
For more info check: http://www.postgresql.org/docs/9.0/interactive/datatype-geometric.html and http://www.postgresql.org/docs/9.0/interactive/functions-geometry.html
PostGIS 是 PostgreSQL 数据库的空间扩展,与许多通用数据库的情况一样,必须在常规安装之上安装空间功能。
PostGIS 网站信息丰富,有很好的文档,所以请前往那里阅读您需要了解的有关获取的所有内容并安装 PostGIS。
安装并测试后,您需要空间启用您的数据库然后一切就都准备好了。当然,如果您有数据集。
PostGIS is the spatial extension for the PostgreSQL database, and as is the case with many general-purpose databases, spatial functions have to be installed on top of a regular install.
The PostGIS website is informative, with nice documentation so head over there and read everything you need to know about obtaining and installing PostGIS.
Once installed and tested you'll need to spatially enable your database and then you're all set. If you have a dataset, of course.