<div dir="ltr"><div><div>It is possible to do by groupping :<br><br></div>the idea is :<br></div><div>you group small polygons by the coordinate of there centroid, rounded (or snapped ot grid) so that polygon less than XX meter are in the same group.<br>
<br></div><div>Example :<br></div><div>SELECT ST_Union(poly.geom )<br></div><div>FROM my_poly AS poly<br></div><div>GROUP BY ST_SnapToGrid(ST_Centroid(poly.geom),XX)<br><br></div><div>Please note that this code doesn't enforce the fact that polygons are touching to merge, but you don"t really need this, because separate polygons will get merged into a multipolygons, which is easy to deal with by dump .<br>
</div><div><br></div><div>Cheers,<br><br>Rémi-C<br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-01-28 Morten Sickel <span dir="ltr"><<a href="mailto:morten@sickel.net" target="_blank">morten@sickel.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I never used it, but it should be along the lines discussed here:<br>
<a href="http://gis.stackexchange.com/questions/49650/merge-polygons-in-postgis" target="_blank">http://gis.stackexchange.com/questions/49650/merge-polygons-in-postgis</a><br>
<br>
if it is just a few, it should be doable to do manually - I don't know if<br>
it is possible to do automatically in SQL<br>
<br>
For each poly with area < some_limit{<br>
   find largest neighboring poly<br>
    // or smallest, or whatever were you are sure you'll get a<br>
well-defined answer<br>
   join the two polys<br>
}<br>
<br>
Morten<br>
<br>
<br>
Astrid Bjørnerød skrev:<br>
<div class="HOEnZb"><div class="h5">> Is there anyone you have written some sql-code for removing the small<br>
> polygons onto one of the neighbor-polygons ?<br>
> Any stabil functions for this task?<br>
><br>
> Astrid<br>
><br>
> -----Opprinnelig melding-----<br>
> Fra: <a href="mailto:postgis-users-bounces@lists.osgeo.org">postgis-users-bounces@lists.osgeo.org</a><br>
> [mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org">postgis-users-bounces@lists.osgeo.org</a>] På vegne av Tom McCallum<br>
> Sendt: 27. januar 2014 20:48<br>
> Til: <a href="mailto:morten@sickel.net">morten@sickel.net</a>; PostGIS Users Discussion<br>
> Emne: Re: [postgis-users] Removing tiny polygons<br>
><br>
> Thanks Morten.  I wanted the first case, so that helps.<br>
><br>
> On Mon, 27 Jan 2014 19:15:18 -0000, Morten Sickel <<a href="mailto:morten@sickel.net">morten@sickel.net</a>><br>
> wrote:<br>
><br>
>> It depends on what you mean with "remove" - do you want to just have<br>
>> the large polygons without the area that is covered by the small ones<br>
>> or do you want to add the area of the small polygons onto one or more<br>
>> of the larges? (e.g. how one typically wants to handle shiver<br>
>> polygons)<br>
>><br>
>> In the first case it is as easy as a query like<br>
>><br>
>> select the_geom where ST_area(the_geom) > ...<br>
>><br>
>> Morten<br>
>><br>
>><br>
>> Tom McCallum skrev:<br>
>>> Hi all,<br>
>>><br>
>>> If I have a polygon geometry field which seems to be made up of a<br>
>>> large number of tiny polygons and some larger ones, what is the best<br>
>>> way to remove polygons below a certain size?  Would I need to<br>
>>> preprocess this and save in a new table/record or can I dynamically<br>
>>> do it?<br>
>>><br>
>>> Thanks<br>
>>><br>
>>> Tom<br>
>>> _______________________________________________<br>
>>> postgis-users mailing list<br>
>>> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
>>> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
>>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> postgis-users mailing list<br>
>> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
>> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
><br>
<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></div></div></blockquote></div><br></div>