[postgis-users] Creating a boundary of an aggregate of buildings

Luca Bertoncello lucabert at lucabert.de
Mon Jan 18 04:02:31 PST 2021


Am 18.01.2021 12:48, schrieb Tomas Straupis:

Hi Tomas,

>   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.

No, I'm not... :) Sorry, I'm really a beginner with PostGIS and 
OpenStreetMaps...

>   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;

I'll try to create a table with landuse = 'residential' (and the other), 
then use this table to generate the boundaries...
Do I understand correctly, you create areas with "forests" and distance 
not greater than 10 meters?

I'll report to the list the result.

Thanks
Luca Bertoncello
(lucabert at lucabert.de)


More information about the postgis-users mailing list