wow, thanks a lot!

indeed, much much nicer!

thanks again,

Denis


On 21. 11. 13 15:47, Nicolas Ribot wrote:
Thanks for the explanation.


You could correct the multipolygons in one step, by using the
st_buildArea function, that "merges" a linework of linestrings,
preserving holes.
To extract polygons boundaries as linestring, st_boundary() is very handy:

The "bad_multipg" table contains invalid multipolygons with adjacent
parts (http://imgur.com/MP6Cy4f)

select gid, st_buildArea(st_boundary(geom))
from bad_multipg
group by gid;

Gives: http://imgur.com/RqlowFI

Nicolas

On 21 November 2013 13:50, Denis Rouzaud <[email protected]> wrote:
Hi Nicolas,

I edit my multi polygons in QGIS, and you're right the geometry becomes
invalid if some parts have adjacent segments.

In a simple case, I would have a multi polygons with 3 parts with 2 parts
adjacent.
http://imgur.com/zvxPFeR

Although the geometry is invalid, my intention is to make it valid, and
therefore merge the two parts, which is impossible in QGIS - AFAIK.

So my intention was to save the geometry as this, and make it valid by a
command.

I could achieve this with a function:
CREATE OR REPLACE FUNCTION distribution.simplemultipoly(geom geometry)
RETURNS geometry AS
$BODY$
     DECLARE
         num_geom integer;
     BEGIN
         SELECT ST_NumGeometries(geom) into num_geom;
         SELECT
ST_Multi(ST_CollectionHomogenize(ST_Union(ST_GeometryN(geom,n))))
             FROM generate_series(1,num_geom) n
             INTO geom;
         RETURN geom;
     END;
$BODY$
LANGUAGE plpgsql;

But I wondered if there was a more direct way.

Cheers,

Denis


On 21. 11. 13 12:42, Nicolas Ribot wrote:

Hi Denis,

In your example, I don't understand how the parts of your
multipolygons can be adjacent. Are they valid ?
Do you have a visual example ?

Thank you

Nicolas


On 21 November 2013 07:32, Denis Rouzaud <[email protected]> wrote:

Hello Rémi,

I was hoping a simplest request without enabling topology but thanks anyway!

Cheers,

Denis


On 20. 11. 13 18:26, Rémi Cura wrote:


 From what I understand of your needs, Postigs topology was designed for
this.
Cheers,

Rémi-C


2013/11/20 Denis Rouzaud <[email protected]>

Hi all,

I am drawing some multipolygons in QGIS and sometimes, I have parts of
them which are adjacent and I'd like to homogenize them to have less parts
and no adjacent parts.

I could do this with a quite complex method:

1. get the number of parts Z:
SELECT ST_NumGeometries(geometry) FROMmytable WHERE id=123;

2. do the simplification using ST_CollectionHomogenize:
SELECT
ST_Multi(ST_CollectionHomogenize(ST_Union(ST_GeometryN(geometry,n)))) FROM
mytable CROSS JOIN generate_series(1,Z) n WHERE id = 123;

3. update manually the result in the table (copy paste).


Does someone has something more straightforward???

Thanks a lot!

Best regards,

Denis
_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Reply via email to