简体   繁体   中英

How to fill in gaps between polygons using postgis functions

I have a similar case as shown in the below question.

https://gis.stackexchange.com/questions/293695/filling-gaps-between-polygons-using-qgis

That solution uses qgis, but I want to use a postgis function on a table on the geometry column. The solution talks about convex hull but not sure how to use the convex_hull postgis function here. I want to fill the gap by moving/merging the gap to the neighboring polygon.

As long as you have a column to group them by (eg, "postal_code"), you can do:

SELECT
    st_convexhull(st_collect(geom_column))
FROM
    my_geom_table
GROUP BY
    grouping_column -- e.g., "postal_code"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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