<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi, Karsten.<br>
    <br>
    One potential problem with merging all the buffers for a given value
    is that you may wind up with a very large polygon that creates its
    own handling issues.<br>
    <br>
    If you only need this for analytical purposes, not for display, then
    it might work better to aim for a middle ground.  You could merge
    the buffers in "clumps".  To do this, you need to partition the
    buffers into spatially-coherent groups.   A simple way to do this is
    to create a grid over the area (say based on the coordinate system
    you are using).  Create a reprsentative point for each buffer (e.g.
    the interior point or centroid).  The buffers can then be assigned
    to the grid cell their point lies in.  Then group the buffers by
    their grid cell, and union each group.<br>
    <br>
    Actually, if you want to carry on and create single polygons, then
    the clumped buffer polygons give a better basis to work from (since
    they should have many fewer points than the source polygons).<br>
    <br>
    If there are still memory issues with the clumped unions, then you
    can carry out this process in an iterated fashion, starting with
    small grid cells and then repeating with a larger size.  (At this
    point you will have basically reimplemented the GEOS CascadedUnion
    algorithm.  But that's ok - performing the algorithm at the SQL
    level allows more control over memory and processing usage).<br>
    <br>
    I'd be interesting to hear if this approach works out.  <br>
    <br>
    Martin<br>
    <br>
    <div class="moz-cite-prefix">On 6/28/2013 5:11 PM, karsten vennemann
      wrote:<br>
    </div>
    <blockquote
      cite="mid:20130629001101.3E8A94F8057@homiemail-a48.g.dreamhost.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 11 (filtered
        medium)">
      <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
      <div class="Section1">
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">I was wondering if there is a good (or
              best practice)
              approach on how to merge geometry features that are
              touching or overlapping and
               have one common value in one table field.<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">Here is what I was trying to do: given
              a large dataset such
              as the (detailed NHD data layer) of rivers in California I
              created multiple
              buffers and inserted the results into a new table with one
              geometry column adding
              a score value to each of the same buffers distances used.
              Thus the buffer
              polygon layer has a score with a value of 10,100,500 and
              1000 m corresponding
              to the buffer distance used. Given the approach I used  to
              create the
              buffers those are often spatially overlapping (because
              there was no merge operation
              of the buffers and because the rivers are split along the
              flow line in multiple
              segments by node in the source shape file). The resulting
              layer works ok for my
              purposes (which is to retrieve information in which
              buffers a certain location
              is intersecting it with the river buffer (results can be
              10,100,500 and 1000 or
              no intersect with the buffers).<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">Now the layers is about 20 GB big disk
              size having a lot of unnecessary
              geometries with are overlapping.<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">How can I go about merging all the
              existing geometries on
              this huge data set into a result layer that has (optimally
              ) only 4 polygons
              with the result scores to find my intersects. <o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">When I tried some of my own approaches
              (e.g. using  st_collect
              and such to do this) so far whenever I started  these
              sever resource intensive
              operations soon these where aborted by the system because
              i got some kind of
              out of memeonry errosr on my server (an ubuntu achjien).
              Is there a good way to
              optimize this kind of query operation without using 100%
              of my server ram so
              that I will not run out of memory or resulting in a
              lengthy query that would be
              running for 6 weeks or so </span></font><font
            face="Wingdings" size="2"><span
              style="font-size:10.0pt;font-family:Wingdings">J</span></font><font
            face="Arial" size="2"><span
              style="font-size:10.0pt;font-family:Arial"> ?<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">Any query examples or general  insight
              are  greatly
              appreciated .<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">Cheers<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:10.0pt;
              font-family:Arial">Karsten<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font color="navy" face="Verdana" size="3"><span
              style="font-size:12.0pt;font-family:Verdana;color:navy"
              lang="DE"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font color="navy" face="Verdana" size="3"><span
              style="font-size:12.0pt;font-family:Verdana;color:navy"
              lang="DE">Karsten Vennemann</span></font><span lang="DE"><o:p></o:p></span></p>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:12.0pt" lang="DE"> <o:p></o:p></span></font></p>
        <p class="MsoNormal"><font color="navy" face="Verdana" size="2"><span
              style="font-size:10.0pt;font-family:Verdana;color:navy"
              lang="DE">Terra GIS Ltd</span></font><span lang="DE"><o:p></o:p></span></p>
        <p class="MsoNormal"><font color="navy" face="Verdana" size="2"><span
              style="font-size:10.0pt;font-family:Verdana;color:navy"
              lang="DE">2119 Boyer Ave E</span></font><span lang="DE"><o:p></o:p></span></p>
        <p class="MsoNormal"><font color="navy" face="Verdana" size="2"><span
              style="font-size:
              10.0pt;font-family:Verdana;color:navy">Seattle, WA 98112</span></font><o:p></o:p></p>
        <p class="MsoNormal"><font color="navy" face="Verdana" size="2"><span
              style="font-size:
              10.0pt;font-family:Verdana;color:navy">USA</span></font><o:p></o:p></p>
        <p class="MsoNormal"><font color="navy" face="Verdana" size="2"><span
              style="font-size:
              10.0pt;font-family:Verdana;color:navy">tel ++ 206 905 1711</span></font><o:p></o:p></p>
        <p class="MsoNormal"><font color="navy" face="Verdana" size="2"><span
              style="font-size:
              10.0pt;font-family:Verdana;color:navy">fax ++ 925 905 1711</span></font><o:p></o:p></p>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:
              12.0pt"><o:p> </o:p></span></font></p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a>
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <p class="" avgcert""="" color="#000000" align="left">No virus
        found in this message.<br>
        Checked by AVG - <a moz-do-not-send="true"
          href="http://www.avg.com">www.avg.com</a><br>
        Version: 2013.0.2904 / Virus Database: 3184/6359 - Release Date:
        05/26/13<br>
        Internal Virus Database is out of date.</p>
    </blockquote>
    <br>
  </body>
</html>