Hi, and thanks for the feedback.&nbsp; I have 8 classes, spread across 191,317 total records.&nbsp; Not sure is that was what you meant by number of geometries.<br>--<br><br><div class="gmail_quote">On Thu, Mar 13, 2008 at 3:56 PM, Paragon Corporation &lt;<a href="mailto:lr@pcorp.us">lr@pcorp.us</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&nbsp;Slight correction<br>
<br>
 &nbsp;SELECT st_multi(st_union(the_geom)) AS the_geom, class FROM<br>
<div class="Ih2E3d">&quot;test_suit_h_crop3_class&quot; GROUP BY class;<br>
<br>
</div>or<br>
<br>
 &nbsp;SELECT st_multi(st_collect(the_geom)) AS the_geom, class FROM<br>
<div class="Ih2E3d">&quot;test_suit_h_crop3_class&quot; GROUP BY class;<br>
<br>
<br>
</div><div class="Ih2E3d">-----Original Message-----<br>
From: Paragon Corporation [mailto:<a href="mailto:lr@pcorp.us">lr@pcorp.us</a>]<br>
Sent: Thursday, March 13, 2008 6:54 PM<br>
To: &#39;PostGIS Users Discussion&#39;<br>
</div><div class="Ih2E3d">Subject: RE: [postgis-users] geomunion HOWTO?<br>
<br>
Also scrap the AsText call you have. &nbsp; I&#39;m guessing its slowing things down<br>
a bit, although probably not much, but its totally unnecessary at anyrate.<br>
Should just be<br>
<br>
</div> &nbsp;SELECT st_multi(st_geomunion(the_geom)) AS the_geom, class FROM<br>
<div class="Ih2E3d">&quot;test_suit_h_crop3_class&quot; GROUP BY class;<br>
<br>
</div><div class="Ih2E3d">You may also want to consider using ST_Collect instead of ST_GeomUnion,<br>
although for large files may not help much.<br>
<br>
<br>
Hope that helps,<br>
Regina<br>
<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a><br>
[mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a>] On Behalf Of Paul<br>
Ramsey<br>
Sent: Thursday, March 13, 2008 6:39 PM<br>
To: PostGIS Users Discussion<br>
Subject: Re: [postgis-users] geomunion HOWTO?<br>
<br>
</div><div><div></div><div class="Wj3C7c">No, you are probably just exercising the geometric operators a lot. It is<br>
possible a cascaded union would do better, but we don&#39;t have that programmed<br>
right now. &nbsp;You could try and make it mildly faster by forcing the union to<br>
happen in a minimally more efficient order, by sorting when you create your<br>
first table, see below...<br>
<br>
No guarantees this makes anything better, just a random guess at a hack.<br>
<br>
On 3/13/08, Roger André &lt;<a href="mailto:randre@gmail.com">randre@gmail.com</a>&gt; wrote:<br>
&gt; I&#39;m trying to find a way to generate &quot;dissolved&quot; geometries without<br>
&gt; exporting shapefiles from PostGIS and performing the operating in<br>
&gt; ArcGIS. &nbsp;I found some instructions online at<br>
&gt;<br>
<a href="http://www.paolocorti.net/public/wordpress/index.php/2007/03/30/union-of-two-geometries-in-postgis/" target="_blank">http://www.paolocorti.net/public/wordpress/index.php/2007/03/30/union-of-two<br>
-geometries-in-postgis/</a>.<br>
&gt; &nbsp;These work fine on their example, but the opeartion when applied to<br>
&gt; my data set never completes. &nbsp;I realize my data set is pretty large<br>
&gt; (), but the same dissolve operation when done via ArcGIS on a<br>
&gt; shapefile exported by pgsql2shp takes around 5 minutes to complete.<br>
&gt; This leads me to believe I&#39;m doing something completely wrong, and I<br>
&gt; would love to get some feedback from those of you with experience doing<br>
this. &nbsp;Below are the steps I&#39;ve done.<br>
&gt;<br>
&gt; Step 1 - create a &quot;crop_3&quot; table that contains only crop3 values, and<br>
&gt; a class. &nbsp;This completes within 30 secs:<br>
&gt;<br>
&gt; begin;<br>
&gt; create table &quot;test_suit_h_crop3_class&quot; ( &quot;alloc_id&quot; char(8) PRIMARY<br>
&gt; KEY, &nbsp;&quot;crop3&quot; numeric, &quot;class&quot; char(8) ); select<br>
&gt; AddGeometryColumn(&#39;&#39;,&#39;test_suit_h_crop3_class&#39;,&#39;the_geom&#39;,&#39;-1&#39;,&#39;MULTIP<br>
&gt; OLYGON&#39;,2); insert into &quot;test_suit_h_crop3_class&quot; (&quot;alloc_id&quot;,<br>
&gt; &quot;crop3&quot;, &quot;class&quot;,<br>
&gt; &nbsp;&quot;the_geom&quot;)<br>
&gt; select vw_suit_area_h.alloc_id, vw_suit_area_h.crop3, case when crop3<br>
&gt; &lt; 1 then &#39;class_0&#39;<br>
&gt; when crop3 &gt;= 1 and crop3 &lt; 860 then &#39;class_1&#39;<br>
&gt; when crop3 &gt;= 860 and crop3 &lt; 1720 then &#39;class_2&#39;<br>
&gt; &nbsp;when crop3 &gt;= 1720 and crop3 &lt; 3440 then &#39;class_3&#39;<br>
&gt; when crop3 &gt;= 3440 and crop3 &lt; 5160 then &#39;class_4&#39;<br>
&gt; when crop3 &gt;= 5160 and crop3 &lt; 6880 then &#39;class_5&#39;<br>
&gt; when crop3 &gt;= 6880 and crop3 &lt; 7740 then &#39;class_6&#39;<br>
&gt; &nbsp;when crop3 &gt;= 7740 then &#39;class_7&#39;<br>
&gt; ELSE &#39;other&#39;<br>
&gt; end AS class,<br>
&gt; vw_suit_area_h.the_geom<br>
&gt; FROM vw_suit_area_h<br>
<br>
ORDER BY X(Extent(the_geom)) + Y(Extent(the_geom))<br>
<br>
&gt; end;<br>
<br>
More ideally, we would bit-interleave the X and Y values, to force the<br>
ordering of the inputs to be very well localized, and even more ideally do<br>
an actual cascaded union.<br>
<br>
The goal is to cause each individual geometry + geometry union to<br>
*reduce* the amount of aggregate linework. When the g+g ops have no<br>
locality, each addition *adds* to the amount of linework, making successive<br>
ops slower and slower and slower.<br>
<br>
&gt; Step 2 - create a temp &quot;dissolve&quot; table to store the results of a<br>
&gt; geometric union run of the above table, grouped by &quot;class&quot;. &nbsp;I run out<br>
&gt; of patience before this ever completes (I&#39;ve let it run for hours.)<br>
&gt;<br>
&gt; begin;<br>
&gt; CREATE TABLE &quot;test_suit_area_h_crop3_diss&quot; ( &nbsp;gid serial PRIMARY KEY,<br>
&gt; &quot;class&quot; char(8) ); select<br>
&gt; AddGeometryColumn(&#39;&#39;,&#39;test_suit_area_h_crop3_diss&#39;,&#39;the_geom&#39;,&#39;-1&#39;,&#39;MU<br>
&gt; LTIPOLYGON&#39;,2); INSERT INTO &quot;test_suit_area_h_crop3_diss&quot;<br>
&gt; (the_geom,class) &nbsp;SELECT astext(multi(geomunion(the_geom))) AS<br>
&gt; the_geom, class FROM &quot;test_suit_h_crop3_class&quot; GROUP BY class; end;<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; Roger<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; &nbsp;postgis-users mailing list<br>
&gt; &nbsp;<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
&gt; <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
&gt;<br>
&gt;<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br>
<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br>