简体   繁体   English

如何在postgis中将许多点转换为多点

[英]how to convert many points to a multipoint in postgis

I need to convert a table of points where i have those columns (id,the_geom) to a multipoints? 我需要将具有这些列(id,the_geom)的点表转换为多点?

Why I need to do this? 为什么我需要这样做? Because I want to create a buffer around each point, and if I work with point i will get one buffer for each point, but what i really nead is on polygone buffer for the whole table. 因为我想在每个点周围创建一个缓冲区,并且如果我使用点,则每个点都会得到一个缓冲区,但是我真正需要的是整个表的多边形缓冲区。 The table countains more than 2000 records. 该表记录了2000多个记录。

here is an image illustrating what i need to do (buffering a multi point): 这是一张图像,说明我需要做什么(缓冲多点):

在此输入图像描述

many thanks 非常感谢

您要查找的函数是汇总形式的ST_Union:

SELECT ST_Multi(ST_Union(the_geom)) FROM myTable;

This might just be a display problem, if you are using pgAdmin III to view the query result. 如果您正在使用pgAdmin III查看查询结果,则可能只是显示问题。 It seems that geometries with a large number of records (eg 2000 in this case) won't display in the data output pane. 似乎具有大量记录的几何图形(在本例中为2000)将不会显示在数据输出窗格中。

You could check the result of your query by using: 您可以使用以下方法检查查询结果:

SELECT ST_AsText(ST_ConcaveHull(ST_Collect(the_geom),0.90)) As cc_hull FROM mytable;

This should return the concave hull polygon as text in the data output pane. 这应该在数据输出窗格中以文本形式返回凹壳多边形。

我认为ST_ConvexHull是您想要的。

SELECT ST_Buffer(ST_ConvexHull(ST_Collect(the_geom)),0.01) FROM mytable;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM