PostGIS点属性到多边形,其中poligon包含点

发布于 2024-12-28 18:47:08 字数 403 浏览 4 评论 0原文

我在 PostGIS 中的相同架构下有一个多边形数据库(bdus)和一个点数据库(bdps)。这些数据库是使用 Shapefile 和 DBF 加载器从 shapefile 导入的。我想要做的是根据包含条件加入多边形图层上的点属性。 因此,对于包含 1 到 n 个点的每个多边形,将点列添加到多边形中。如果有多个点,一种好的方法是平均列值。

有人可以指导我吗?我是 PostGreSQL 和 PostGIS 的新手,但我设法运行此查询

SELECT * FROM bdps
JOIN
bdus
ON
ST_Contains(bdus.the_geom, bdps.the_geom);

,该查询返回一个表,其中 bdps 与相应的 bdus 连接,但我想要相反的结果。

预先感谢您的任何帮助!

I have a polygon database (bdus) and a point database (bdps) under the same schema in PostGIS. These databases were imported from shapefiles with the Shapefile and DBF loader. What I want to do is to join the point attributes on the polygon layer based on the contain criteria.
So for every polygon that contain one to n points, to add the columns of points to polygons. If there are more than one point a good approach would be to average column values.

Can someone guide me? I am new to PostGreSQL and PostGIS but I managed to run this query

SELECT * FROM bdps
JOIN
bdus
ON
ST_Contains(bdus.the_geom, bdps.the_geom);

which return a table with bdps joined with the corresponding bdus, but I want the reverse.

Thanks in advance for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鸠书 2025-01-04 18:47:08

您的意思是,您想要使用满足 ST_Contains(polys,points) 标准的多边形和点创建一个新的多边形吗?

SELECT ST_Union(bdus.the_geom, bdps.the_geom) FROM bdus,bdps WHERE 
ST_Contains(bdus.the_geom, bdps.the_geom);

Did you meant, that you want to create a new polygon with the polygon and the points that satisfy the ST_Contains(polys, points) criteria?

SELECT ST_Union(bdus.the_geom, bdps.the_geom) FROM bdus,bdps WHERE 
ST_Contains(bdus.the_geom, bdps.the_geom);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文