<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>RE: [postgis-devel] More Cascade Union Adventures</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Martin,<BR>
<BR>
Just loaded that plugin - unless I put it in the wrong folder. - it just seemed to create an option called aggregation-options under plugins which seems to require two layers and does union, count between the 2 layers.&nbsp; So nope doesn't sound like Cascaded union and didn't seem to change anything with the union function.<BR>
<BR>
If OpenJump union function isn't doing cascaded union, then what is that count down thing for.&nbsp; Doing the 30,000 it displays something like this<BR>
<BR>
Computing Union<BR>
1/8 (32,278)<BR>
2/8 (8070)<BR>
3/8 ... /2018<BR>
86/505<BR>
1/127<BR>
6/8 (2/32)<BR>
8/8 (2/3)<BR>
3/3 (8/8)<BR>
<BR>
I also thought its speed of unioning of Mass towns was pretty impressive.<BR>
<BR>
Thanks,<BR>
Regina<BR>
-----Original Message-----<BR>
From: postgis-devel-bounces@postgis.refractions.net on behalf of Obe, Regina<BR>
Sent: Wed 8/13/2008 5:40 PM<BR>
To: PostGIS Development Discussion<BR>
Subject: RE: [postgis-devel] More Cascade Union Adventures<BR>
<BR>
I assumed it was since it was counting down like in some sort of upside down pyramid<BR>
<BR>
500<BR>
255<BR>
10<BR>
:<BR>
:<BR>
<BR>
So it seemed like it was doing some sort of division of the geometries.&nbsp; I'll give the below<BR>
a try.&nbsp; Maybe I misunderstood what that counting was for.<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: postgis-devel-bounces@postgis.refractions.net on behalf of Martin Davis<BR>
Sent: Wed 8/13/2008 4:49 PM<BR>
To: PostGIS Development Discussion<BR>
Subject: Re: [postgis-devel] More Cascade Union Adventures<BR>
<BR>
Yep, I don't Hausdorff distance is available in very many places.&nbsp; Pity,<BR>
because it is a very useful metric for comparing geometry.&nbsp; The full<BR>
Hausdorff distance is quite challenging to implement, but I have made a<BR>
VertexHausdorffDistance approximation which is just as useful in most<BR>
situations, and is a lot simpler to implement (and faster to run).<BR>
<BR>
By the way, are you sure that OpenJUMP is using CascadedUnion?&nbsp; AFAIK it<BR>
didn't in the past... Michael Michaud has just released (today!) an<BR>
extension which I think does use CascadedUnion - so you might want to<BR>
try that.<BR>
<BR>
<A HREF="http://geo.michaelm.free.fr/OpenJUMP/resources/aggregation-0.1.jar">http://geo.michaelm.free.fr/OpenJUMP/resources/aggregation-0.1.jar</A><BR>
<BR>
When I did the original testing with the 30K polygon dataset that you're<BR>
using, I was getting times of around 20 sec using CascadedUnion...<BR>
<BR>
<BR>
<BR>
Obe, Regina wrote:<BR>
&gt;<BR>
&gt; Martin,<BR>
&gt; Pardon my ignorance.<BR>
&gt;<BR>
&gt; I don't see a Hausdorff distance in OpenJump or maybe it goes by a<BR>
&gt; more verbose name and the descriptions I read about Hausdorff<BR>
&gt; distances are greek to me.<BR>
&gt;<BR>
&gt; Well the Mass town test seems to pass my trivial test exercises. It<BR>
&gt; looks like massachusetts with no visually apparent gaps, has the same<BR>
&gt; number points in all cases, similar area<BR>
&gt;<BR>
&gt; both num points - 476026<BR>
&gt; both num geometries - 694<BR>
&gt; area (ST_CascadeUnion - 2.094208570266725E10)<BR>
&gt; area (JTS - 2.0942085702666965E10)<BR>
&gt;<BR>
&gt;<BR>
&gt; -----Original Message-----<BR>
&gt; From: postgis-devel-bounces@postgis.refractions.net on behalf of<BR>
&gt; Martin Davis<BR>
&gt; Sent: Wed 8/13/2008 11:51 AM<BR>
&gt; To: PostGIS Development Discussion<BR>
&gt; Subject: Re: [postgis-devel] More Cascade Union Adventures<BR>
&gt;<BR>
&gt; I wouldn't expect to have the results be exactly equal - the union code<BR>
&gt; is likely to be input-order dependent.<BR>
&gt;<BR>
&gt; And the difference in areas doesn't seem surprising either - it's way<BR>
&gt; down in the small decimal places, which would occur even with slight<BR>
&gt; differences in the geometry.<BR>
&gt;<BR>
&gt; A more revealing test would be to compute the Hausdorff distance between<BR>
&gt; the union boundaries - that would show if they differed by very much,<BR>
&gt; and where.&nbsp; PostGIS doesn't have this - I can't remember whether<BR>
&gt; OpenJUMP does or not.&nbsp; JEQL has this operation, too.<BR>
&gt;<BR>
&gt; Obe, Regina wrote:<BR>
&gt; &gt; Now testing all including JTS 1.9.0 (OpenJump) on a Win XP runing<BR>
&gt; &gt; PostgreSQL 8.3.1, PostGIS 1.3.3, Geos 3.0.0.&nbsp; It appears using array<BR>
&gt; &gt; trumps all, Cascade aggregate union is a vast improvement over ST_Union<BR>
&gt; &gt; (ST_Union I didn't bother testing of course because it owuld never<BR>
&gt; &gt; finish on this test), but evidentally the array accum calls give a major<BR>
&gt; &gt; penalty.<BR>
&gt; &gt;<BR>
&gt; &gt; I found some things I found a bit possibly disturbing.&nbsp; Maybe its just<BR>
&gt; &gt; the nature of unioning in different orders.&nbsp; I compared all 3 outputs<BR>
&gt; &gt; and none of them are binary equal or even ST_Equals for that matter.<BR>
&gt; &gt;<BR>
&gt; &gt; However all 3 give same basic stats using OpenJump - e.g<BR>
&gt; &gt; All result in = 32972 pts&nbsp;&nbsp;&nbsp;<BR>
&gt; &gt; components = 10<BR>
&gt; &gt; lengths and areas are off by a bit<BR>
&gt; &gt; length = agg cascade union = 17.262684721407624, k nested union =<BR>
&gt; &gt; 17.262684721407688,<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jts = 17.262684721406348<BR>
&gt; &gt;<BR>
&gt; &gt; Should I be bothered by any of these or are they just rounding errors?<BR>
&gt; &gt;<BR>
&gt; &gt; --Other odd thing is that the array approach is not as good as it was on<BR>
&gt; &gt; my other machine bu the aggregate union performs better.&nbsp; I'll just<BR>
&gt; &gt; chuck this off to different postgresql version, and memory settings.<BR>
&gt; &gt;<BR>
&gt; &gt; Thanks,<BR>
&gt; &gt; Regina<BR>
&gt; &gt;<BR>
&gt; &gt;<BR>
&gt; &gt; --&nbsp;&nbsp; 209,563 | 198,391 ms - SELECT 198391/1000.00/60 = 3.31 minutes<BR>
&gt; &gt;<BR>
&gt; &gt; SELECT ST_CascadeUnion(the_geom)<BR>
&gt; &gt; FROM (SELECT the_geom FROM sample_poly) As foo;<BR>
&gt; &gt;<BR>
&gt; &gt; -- 48,594 ms | 47,688 ms = 48 secs<BR>
&gt; &gt; SELECT st_unitecascade_garray_sort(ARRAY(SELECT the_geom FROM<BR>
&gt; &gt; sample_poly));<BR>
&gt; &gt;<BR>
&gt; &gt; -- 74,515 ms | 74,922 ms = SELECT 74515/1000.00/60 = 1.24 minutes<BR>
&gt; &gt; SELECT ST_Union(the_geom) AS the_geom, 'nested union'<BR>
&gt; &gt; FROM (<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp; SELECT min(id) AS id, ST_Union(the_geom) AS the_geom<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp; FROM (<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT min(id) AS id, ST_Union(the_geom) AS the_geom<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM (<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT min(id) AS id, ST_Union(the_geom) AS the_geom<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM (<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT min(id) AS id, ST_Union(the_geom) AS the_geom<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM (SELECT the_geom, id FROM sample_poly) As foo<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GROUP BY round(id/10)<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ORDER BY id) AS tmp1<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GROUP BY round(id/100)<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ORDER BY id) AS tmp2<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GROUP BY round(id/1000)<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ORDER BY id) AS tmp3<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp; GROUP BY round(id/10000)<BR>
&gt; &gt;&nbsp;&nbsp;&nbsp; ORDER BY id) AS tmp4<BR>
&gt; &gt; GROUP BY round(id/100000);<BR>
&gt; &gt;<BR>
&gt; &gt;<BR>
&gt; &gt; -- Open Jump JTS 1.9.0 Win XP<BR>
&gt; &gt; --After loading running union across the whole set<BR>
&gt; &gt; --1.14 minutes<BR>
&gt; &gt; --Loading database query<BR>
&gt; &gt; SELECT ST_AsBinary(the_geom)<BR>
&gt; &gt; FROM sample_poly;<BR>
&gt; &gt;<BR>
&gt; &gt; -----------------------------------------<BR>
&gt; &gt; The substance of this message, including any attachments, may be<BR>
&gt; &gt; confidential, legally privileged and/or exempt from disclosure<BR>
&gt; &gt; pursuant to Massachusetts law. It is intended<BR>
&gt; &gt; solely for the addressee. If you received this in error, please<BR>
&gt; &gt; contact the sender and delete the material from any computer.<BR>
&gt; &gt;<BR>
&gt; &gt; _______________________________________________<BR>
&gt; &gt; postgis-devel mailing list<BR>
&gt; &gt; postgis-devel@postgis.refractions.net<BR>
&gt; &gt; <A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-devel">http://postgis.refractions.net/mailman/listinfo/postgis-devel</A><BR>
&gt; &gt;<BR>
&gt; &gt;&nbsp;<BR>
&gt;<BR>
&gt; --<BR>
&gt; Martin Davis<BR>
&gt; Senior Technical Architect<BR>
&gt; Refractions Research, Inc.<BR>
&gt; (250) 383-3022<BR>
&gt;<BR>
&gt; _______________________________________________<BR>
&gt; postgis-devel mailing list<BR>
&gt; postgis-devel@postgis.refractions.net<BR>
&gt; <A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-devel">http://postgis.refractions.net/mailman/listinfo/postgis-devel</A><BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; ------------------------------------------------------------------------<BR>
&gt;<BR>
&gt; _______________________________________________<BR>
&gt; postgis-devel mailing list<BR>
&gt; postgis-devel@postgis.refractions.net<BR>
&gt; <A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-devel">http://postgis.refractions.net/mailman/listinfo/postgis-devel</A><BR>
&gt;&nbsp;&nbsp;<BR>
<BR>
--<BR>
Martin Davis<BR>
Senior Technical Architect<BR>
Refractions Research, Inc.<BR>
(250) 383-3022<BR>
<BR>
_______________________________________________<BR>
postgis-devel mailing list<BR>
postgis-devel@postgis.refractions.net<BR>
<A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-devel">http://postgis.refractions.net/mailman/listinfo/postgis-devel</A><BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>