[postgis-users] Removing tiny polygons

Tom McCallum termcc at googlemail.com
Wed Jan 29 01:46:23 PST 2014


select st_isvalid(wkb_geometry) from mytable
NOTICE:  Ring Self-intersection at or near point 4173.162435251591  
6968968.0578562981
  st_isvalid
------------
  f
(1 row)

It had 287 interior rings.  So am searching now for the largest.  Thanks  
would not have found this without your help!



On Tue, 28 Jan 2014 15:46:21 -0000, Rémi Cura <remi.cura at gmail.com> wrote:

> If you are saying that dump doesn't break your multi polygon into pieces,
> either
> _ dump has a bug (unlikely)
> _ you don't have a multipolygon but a geometry collection (try
> ST_Dump(ST_CollectionExtract(geom,2)))
> _you have an invalid simple polygon (try st_isvalid() )
> _you have a simple polygon where interior rings should be stand alone
> polygon, use St_ringextract
> Cheers,
>
> Rémi-C
>
>
> 2014-01-28 Hugues François <hugues.francois at irstea.fr>
>
>> What you say sounds very weird to me. I don't understand how postgis can
>> consider a multipolygon as a polygon. Could you provide us a test  
>> sample of
>> your data ?
>>
>> Hugues.
>>
>>
>>
>>
>> -----Original Message-----
>> From: postgis-users-bounces at lists.osgeo.org [mailto:
>> postgis-users-bounces at lists.osgeo.org] On Behalf Of Tom McCallum
>> Sent: Tuesday, January 28, 2014 3:25 PM
>> To: morten at sickel.net; PostGIS Users Discussion
>> Subject: Re: [postgis-users] Removing tiny polygons
>>
>> Yes I just want the largest polygons.  The problem being that when I
>> simplify the polygon it appears to need a lot more simplification due to
>> these islands rather than if it just did did one mainland polygon (
>> asGeoJson comes in at 437 polygons rather than 1 polygon).  Not sure why
>> GeoJson can split it into multiple polygons but Dump[] just hands me  
>> one.
>>
>> Was hoping to use ST_Area but currently cannot break down the single
>> polygon.
>>
>> Interestingly QGIS can, if I do single to multipart it can break down  
>> into
>> main landmass and islands.  What might be an equivalent postgis method  
>> for
>> doing this?
>>
>>
>> On Mon, 27 Jan 2014 19:15:18 -0000, Morten Sickel <morten at sickel.net>
>> wrote:
>>
>> > It depends on what you mean with "remove" - do you want to just have
>> > the large polygons without the area that is covered by the small ones
>> > or do you want to add the area of the small polygons onto one or more
>> > of the larges? (e.g. how one typically wants to handle shiver
>> > polygons)
>> >
>> > In the first case it is as easy as a query like
>> >
>> > select the_geom where ST_area(the_geom) > ...
>> >
>> > Morten
>> >
>> >
>> > Tom McCallum skrev:
>> >> Hi all,
>> >>
>> >> If I have a polygon geometry field which seems to be made up of a
>> >> large number of tiny polygons and some larger ones, what is the best
>> >> way to remove polygons below a certain size?  Would I need to
>> >> preprocess this and save in a new table/record or can I dynamically
>> >> do it?
>> >>
>> >> Thanks
>> >>
>> >> Tom
>> >> _______________________________________________
>> >> postgis-users mailing list
>> >> postgis-users at lists.osgeo.org
>> >> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>> >>
>> >
>> >
>> > _______________________________________________
>> > postgis-users mailing list
>> > postgis-users at lists.osgeo.org
>> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


More information about the postgis-users mailing list