[postgis-users] Need help to create an help table

Tomas Straupis tomasstraupis at gmail.com
Sat Jan 30 10:20:49 PST 2021


2021-01-30, št, 15:56 Luca Bertoncello rašė:
>>   1. Reduce the number of vertexes in a polygon (say use st_simplify,
>> st_snaptogrid or other functions which reduce number of vertexes)
>
> I already did that with a query you suggest me:
>
>   UPDATE city_boundaries SET way =
> ST_Multi(ST_SimplifyPreserveTopology(way, 100));

  100 is not fixed in stone. Play around with different numbers
depending on what is the result you need. The higher the value - less
nodes remain - less complex geometry - faster geometry operations. But
at the same time the more you simplify, the more geometry loses its
original shape. So you have to judge yourself where is your sweet
point.

>>   2. Split the initial polygon (thus making more polygons but with
>> fewer vertexes), process the parts and then reassemble the polygon.
> How can I do that?

  You will have to think how to do it. Maybe you could use
st_subdivide, maybe you need to think of some more complex way of
splitting the polygon.

> Do you mean something like that?
>
> UPDATE city_boundaries SET way =
> ST_Multi(ST_SimplifyPreserveTopology(way, 100));
> UPDATE city_boundaries SET way = ST_Makevalid(ST_Buffer(ST_Buffer(wayn1,
> 50, 'join=miter'), -50, 'join=miter'));
> UPDATE city_boundaries SET way = ST_Makevalid(ST_Buffer(ST_Buffer(wayn1,
> 100, 'join=miter'), -100, 'join=miter'));
> UPDATE city_boundaries SET way = ST_Makevalid(ST_Buffer(ST_Buffer(wayn1,
> 150, 'join=miter'), -150, 'join=miter'));
> UPDATE city_boundaries SET way = ST_Makevalid(ST_Buffer(ST_Buffer(wayn1,
> 200, 'join=miter'), -200, 'join=miter'));
> UPDATE city_boundaries SET way = ST_Makevalid(ST_Buffer(ST_Buffer(wayn1,
> 250, 'join=miter'), -250, 'join=miter'));
> UPDATE city_boundaries SET way = ST_Makevalid(ST_Buffer(ST_Buffer(wayn1,
> 300, 'join=miter'), -300, 'join=miter'));

  This is also good, but it is not exactly what I ment.
  You cluster polygons with a distance of say 10m, simplify and buffer+- them.
  Then you cluster THE RESULT of the first action again but now with a
distance of say 40m, simplify (with a larger step) and buffer+- with a
larger argument.
  Rinse and repeate until you get what you want.
  (If you're creating a multi-scale map you will usually want to leave
results of different steps to be used on different scales)

> I don't know this program... What is it? Can I run it on my PC using the
> database on another PC?

  Yes, it is probably the best known/powerful GIS app in opensource
world. Comparable to A**GIS. QGIS can connect/read/display/edit data
in PostgreSQL/PostGIS.

-- 
Tomas


More information about the postgis-users mailing list