[postgis-users] Creating a boundary of an aggregate of buildings
Tomas Straupis
tomasstraupis at gmail.com
Mon Jan 18 03:48:14 PST 2021
> unfortunately it does not work as expected, since I have always many
> many many little areas...
>
> Any other idea?
Are you sure you're getting a combined multigeometry before applying
buffer+-? All small polygons which you expect to be aggregated into
one should be in one geometry (one row) before doing buffering.
1. Increase buffer size.
2. ST_ConvexHull, ST_ConcaveHull.
Here is a working forest aggregation routine.
create table gen_forest as
select nextval('gen_forest_seq') AS id
,0::bigint AS way_area
,10 AS res
,ST_CollectionExtract(unnest(ST_ClusterWithin(way, 10)),
3)::geometry(MultiPolygon, 3857) as way
from planet_osm_polygon
where landuse = 'forest';
delete from gen_forest where st_area(st_buffer(way, -10)) < 10 and res = 10;
update gen_forest set way =
st_makevalid(st_multi(st_simplifypreservetopology(st_buffer(st_buffer(way,
10, 'quad_segs=1'), -10, 'quad_segs=1'), 10))) where res = 10;
update gen_forest set way_area = st_area(way) where res = 10;
--
Tomas
More information about the postgis-users
mailing list