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

2021-01-29 Thread Luca Bertoncello
Am 27.01.2021 22:07, schrieb Luca Bertoncello: Hi list derived from what you suggested -- Aggregates all clustered polygons by adding 120m and then removing 120m from all sides UPDATE city_boundaries SET way = ST_Makevalid(ST_Multi(ST_Buffer(ST_Buffer(way, 120, 'join=miter'), -120, 'join=mite

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

2021-01-28 Thread Stephen Woodbridge
On 1/28/2021 10:34 AM, Luca Bertoncello wrote: Am 28.01.2021 16:21, schrieb Tomas Straupis:   Something like:   UPDATE city_boundaries SET way = ST_SimplifyPreserveTopology(way, 100);   before running running buffer +- update. I get the error: FEHLER:  Geometry type (Polygon) does not ma

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

2021-01-28 Thread Luca Bertoncello
Am 28.01.2021 16:45, schrieb Tomas Straupis: 2021-01-28, kt, 17:35 Luca Bertoncello rašė: I get the error: FEHLER: Geometry type (Polygon) does not match column type (MultiPolygon) Could you say me how to correct the query? Add ST_Multi like this: UPDATE city_boundaries SET way = ST_Mu

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

2021-01-28 Thread Tomas Straupis
2021-01-28, kt, 17:35 Luca Bertoncello rašė: > I get the error: > > FEHLER: Geometry type (Polygon) does not match column type > (MultiPolygon) > > Could you say me how to correct the query? Add ST_Multi like this: UPDATE city_boundaries SET way = ST_Multi(ST_SimplifyPreserveTopology(way, 10

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

2021-01-28 Thread Luca Bertoncello
Am 28.01.2021 16:21, schrieb Tomas Straupis: Something like: UPDATE city_boundaries SET way = ST_SimplifyPreserveTopology(way, 100); before running running buffer +- update. I get the error: FEHLER: Geometry type (Polygon) does not match column type (MultiPolygon) Could you say

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

2021-01-28 Thread Luca Bertoncello
Am 28.01.2021 16:21, schrieb Tomas Straupis: Hi Tomas, If 300m buffer +- is good for your scale, then you can reduce the Yes, 300m is good for what I need, I tested it on a small region. number of vertexes thus speeding up buffer operations considerably. For example you could dp simplify

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

2021-01-28 Thread Tomas Straupis
2021-01-27, tr, 23:08 Luca Bertoncello rašė: > My Table city_boundary has about 108.000 rows (and only two fields: id > and way) and the aggretation query: > > UPDATE city_boundaries SET way = > ST_Makevalid(ST_Multi(ST_Buffer(ST_Buffer(way, 300, 'join=miter'), -300, > 'join=miter'))); > > <...> >

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

2021-01-27 Thread Luca Bertoncello
Am 18.01.2021 um 15:09 schrieb Tomas Straupis: Hi Tomas and all, I finally imported all Europe data from OSM in my PostGIS and I created the table city_boundary as you suggested, with JOIN to another help table in order to restrict the search. My Table city_boundary has about 108.000 rows (and o

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

2021-01-19 Thread Luca Bertoncello
Am 19.01.2021 09:01, schrieb Hugues François: Hi Hugues The attached function could help you to solve your issues and test several thresholds when adapted to your own database. I'm sorry it's written in a weird French-English style but the queries should help you to understand the variable name

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

2021-01-19 Thread Hugues François
threshold. HTH, Hug -- - Mail original - De: "Luca Bertoncello" À: "PostGIS Users Discussion" Envoyé: Lundi 18 Janvier 2021 21:37:44 Objet: Re: [postgis-users] Creating a boundary of an aggregate of buildings Am 18.01.2021 um 15:09 schrieb Tomas Straupis: > I

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

2021-01-18 Thread Luca Bertoncello
Am 18.01.2021 um 15:09 schrieb Tomas Straupis: > I've tested on Vilnius and get fine results with coefficients given > below (but for you numbers could be different depending on which is > your target scale). Hi again, I think I'm on the right way... I can select the boundaries by size, so I can

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

2021-01-18 Thread Luca Bertoncello
Am 18.01.2021 15:09, schrieb Tomas Straupis: Hi Tomas, I've tested on Vilnius and get fine results with coefficients given below (but for you numbers could be different depending on which is your target scale). It may be a right way, but I'd like to have a boundary of all extracted buildings

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

2021-01-18 Thread Tomas Straupis
I've tested on Vilnius and get fine results with coefficients given below (but for you numbers could be different depending on which is your target scale). Here ClusterWithin is reduced to 200 - group polygons which are closer than 200 meters. This also means that buffering should be at least 200/

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

2021-01-18 Thread Luca Bertoncello
Am 18.01.2021 14:38, schrieb Tomas Straupis: Hi This statement has problems. You're adding a buffer of 10 then removing a buffer of 500 (so basically leaving only very large polygons and they are eroded by 500meters). Then you're simplifying the result with a 500m value (a lot). Try this

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

2021-01-18 Thread Tomas Straupis
2021-01-18, pr, 15:05 Luca Bertoncello rašė: > UPDATE city_boundaries SET way = > ST_Makevalid(ST_Multi(ST_SimplifyPreserveTopology(ST_Buffer(ST_Buffer(way, > 10, 'quad_segs=1'), -500, 'quad_segs=1'), 500))) WHERE res = 10; This statement has problems. You're adding a buffer of 10 then removin

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

2021-01-18 Thread Luca Bertoncello
Am 18.01.2021 13:55, schrieb Tomas Straupis: Hi, ST_ClusterWithin(way, 500)) <- this combines all polygons which are less than 500 meters apart. For landuses 10 meters for ST_Buffer not enough. Try increasing 10 to say a 400(m) or even more (especially given you're clustering polygons with

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

2021-01-18 Thread Tomas Straupis
2021-01-18, pr, 14:35 Luca Bertoncello rašė: > So, if I undestand correctly I create a new table city_boundaries with > all buildings of the given types in a radius of 10 meters, is if > correct? Yes (just not buildings, but landuses). ST_ClusterWithin(way, 500)) <- this combines all polygons

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

2021-01-18 Thread Luca Bertoncello
Am 18.01.2021 12:48, schrieb Tomas Straupis: Hi again Here is a working forest aggregation routine. I'm feeling really dumb, but I can't get your example working... Here my code: CREATE SEQUENCE city_boundaries_seq START 1; ALTER SEQUENCE city_boundaries_seq OWNER TO _renderd; CREATE TABL

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

2021-01-18 Thread Luca Bertoncello
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

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

2021-01-18 Thread Tomas Straupis
> 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)

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

2021-01-18 Thread Luca Bertoncello
Am 18.01.2021 10:51, schrieb Tomas Straupis: Hi Tomas Have not tested your statement, but besides missing comma between 1000 and 'quad_segs=1' looks fine. I use such buffering for landuse (forest, water) aggregation for different scales. So this is my query: (SELECT ST_Buffer(S

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

2021-01-18 Thread Tomas Straupis
2021-01-18, pr, 11:26 Luca Bertoncello rašė: > Do you mean something like that? > >SELECT ST_Buffer(ST_Buffer(way, 1000'quad_segs=1'), -1000, > 'quad_segs=1') >FROM > (SELECT way, ST_ClusterDBSCAN(way, eps := 50, minpoints := 2) > OVER () AS cid > FROM planet_osm_

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

2021-01-18 Thread Luca Bertoncello
Am 18.01.2021 10:21, schrieb Tomas Straupis: Hi Tomas, In order to do aggregation/dissolving, you can try using st_buffer on grouped (clustered) geometries. Something like this: st_buffer(st_buffer(your_clustered_aggregated_geometry, 1000), -1000) Depending on details you can add an o

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

2021-01-18 Thread Tomas Straupis
2021-01-18, pr, 09:26 Luca Bertoncello rašė: > Now I have an "ID" to group the nearing buildings, but I always don't > have an idea, how to create a boundary over this aggregates... In order to do aggregation/dissolving, you can try using st_buffer on grouped (clustered) geometries. Something

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

2021-01-17 Thread Luca Bertoncello
Hi list! I'm always trying to create a style for a map in ICAO style using data from OpenStreetMaps... Now I'm trying to display the city boundaries. Problem: in the database I just have the political (administrative) boundaries, and I need the physical boundaries. With "physical boundaries" I