<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:o = 
"urn:schemas-microsoft-com:office:office"><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=078124119-11042006>The 
WKT for these geometries is:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=078124119-11042006></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>POLYGON ((5416315.620858896 
5657891.5790832825, 5416313.375312048 5657896.390969821, 5416306.81 5657888.38, 
5416305.59 5657887.05, 5416307.29 5657885.63, 5416308.48 5657887.01, 5416310.51 
5657885.35, 5416315.620858896 5657891.5790832825))</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>POLYGON ((5416313.375312049 
5657896.39096982, 5416315.620858896 5657891.5790832825, 5416317.64 5657894.04, 
5416313.94 5657897.08, 5416313.375312049 5657896.39096982))</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=078124119-11042006><FONT face=Arial color=#0000ff size=2>A 
couple of observations:</FONT></SPAN></DIV>
<DIV><SPAN class=078124119-11042006><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=078124119-11042006><FONT face=Arial color=#0000ff size=2>- 
These are two geometries which touch at a single point&nbsp; POINT 
(5416315.620858896 5657891.5790832825)&nbsp;&nbsp; Given this,&nbsp;the expect 
result from&nbsp;Union IS a MultiPolygon.&nbsp; They may appear on-screen to 
touch along a line, but the points POINT (5416313.375312048 5657896.390969821) 
and POINT (5416313.375312049 5657896.39096982) are very slightly 
different.</FONT></SPAN></DIV>
<DIV><SPAN class=078124119-11042006><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=078124119-11042006><FONT face=Arial color=#0000ff size=2>- The 
precision of these geometries is very high (10 decimal places).&nbsp; My guess 
is this is much higher than your data accuracy.&nbsp; You will have fewer 
problems with GEOS if you use lower precision data.&nbsp; This means using 
SnapToGrid *all the way through* your computations.</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=078124119-11042006><FONT face=Arial color=#0000ff size=2>If you 
have problems using snapped geometries, you should try posting an example of 
that.</FONT></SPAN></DIV>
<DIV><SPAN class=078124119-11042006><FONT face=Arial color=#0000ff 
size=2>&nbsp;</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV align=center><FONT face=Arial size=2><STRONG>Martin Davis, Senior Technical 
Architect</STRONG><BR><STRONG><FONT color=#0000ff>Vivid Solutions 
Inc.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<I>www.vividsolutions.com</I></FONT></STRONG><BR></FONT><EM><FONT face=Arial 
size=2>Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5<BR>Phone: (250) 
385 6040 - Local 308 Fax: (250) 385 6046</FONT></EM></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> 
  postgis-users-bounces@postgis.refractions.net 
  [mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of 
  </B>Rene Neidt<BR><B>Sent:</B> April 11, 2006 11:24 AM<BR><B>To:</B> 
  postgis-users@postgis.refractions.net<BR><B>Subject:</B> [postgis-users] GEOS 
  Problems<BR><BR></FONT></DIV>
  <DIV><FONT face=Arial size=2>Hello Postgis Users,</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>we are building a complex application with many 
  gis operations.<BR>The most problems occured within the geomUnion, 
  intersection and difference functions.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>We have some different problems using GEOS 
  operations. We think that is a <BR>problem with tolerances while processing 
  the geometries.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>We have tried "SnapToGrid","Buffer" with zero 
  distance and so on ... , but we can't find a<BR>solution that will work in all 
  cases.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Either we get an Error from Geos (eg. "No 
  outgoing edge found" and many more), or we dont get the <BR>expected 
  result.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>The following example creates two different 
  results for the same operation with the<BR>"same" geometries, but different 
  geometrie casts.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>----- import with psql 
  -----------------------------------------------</FONT></DIV>
  <DIV>&nbsp;</DIV><FONT face=Arial size=2>
  <DIV><BR>CREATE TABLE t1 (<BR>&nbsp;&nbsp;&nbsp; geom 
  public.geometry<BR>);<BR>COPY t1 (geom) FROM 
  stdin;<BR>01030000000100000008000000F326BCE75EA9544154B30FE548955541D31C05585EA9544149A605194A9555413D0AD7B35CA9544185EB5118489555415C8FC2655CA95441333333C347955541295C8FD25CA9544185EB516847955541EC51B81E5DA954410AD7A3C0479555410AD7A3A05DA954416666665647955541F326BCE75EA9544154B30FE548955541<BR>01030000000100000005000000D41C05585EA9544148A605194A955541F326BCE75EA9544154B30FE5489555418FC2F5685FA95441295C8F8249955541C3F5287C5EA9544152B81E454A955541D41C05585EA9544148A605194A955541<BR>\.<BR>&nbsp;<BR>-- 
  the statement below will produce a single-polygon with 10 Points, <BR>-- this 
  is the expected result ...<BR>select asText(geomUnion(asText(geom))) from 
  t1</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>-- but this statement produces a multipolygon with 13 points 
  <BR>select asText(geomUnion(geom)) from t1&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>-- Postgres Version : "PostgreSQL 8.1.2 on i686-pc-mingw32, compiled 
  by GCC gcc.exe (GCC) 3.4.2 (mingw-special)"<BR>-- Postgis Version&nbsp; : 
  "POSTGIS="1.1.1" GEOS="2.2.1-CAPI-1.0.1" PROJ="Rel. 4.4.9, 29 Oct 2004" 
  USE_STATS (procs 1.1.0 upgrade)"&nbsp;<BR>-- OS: Windows Server 
  2003</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><SPAN class=622472218-11042006><FONT face=Arial size=2>-- Best regards 
  </FONT></SPAN></DIV>
  <DIV class=Section1>
  <P><SPAN style="FONT-SIZE: 7.5pt; COLOR: navy; FONT-FAMILY: Arial"><SPAN 
  class=622472218-11042006>&nbsp;</SPAN>__________________________________________________________________<o:p></o:p></SPAN></P>
  <P><SPAN style="FONT-SIZE: 7.5pt; COLOR: navy; FONT-FAMILY: Arial">Rene 
  Neidt<BR>Projektleiter Software<BR>IDU Ingenieurgesellschaft für 
  Datenverarbeitung und Umweltschutz mbH<BR>Theodor-Körner-Allee 16<BR>02763 
  Zittau<BR>Germany<o:p></o:p></SPAN></P>
  <P><SPAN style="FONT-SIZE: 7.5pt; COLOR: navy; FONT-FAMILY: Arial">Tel ++49 
  3583 61-15-37<BR>Fax ++49 3583 61-12-10<o:p></o:p></SPAN></P>
  <P><SPAN style="FONT-SIZE: 7.5pt; COLOR: navy; FONT-FAMILY: Arial">Internet 
  </SPAN><U><SPAN 
  style="FONT-SIZE: 7.5pt; COLOR: blue; FONT-FAMILY: Arial">http://www.idu.de/</SPAN></U><SPAN 
  style="FONT-SIZE: 7.5pt; COLOR: navy; FONT-FAMILY: Arial">, </SPAN><U><SPAN 
  style="FONT-SIZE: 7.5pt; COLOR: blue; FONT-FAMILY: Arial">http://www.webmapserver.de/<BR></SPAN></U><SPAN 
  style="FONT-SIZE: 7.5pt; COLOR: navy; FONT-FAMILY: Arial">Anfahrt: 
  </SPAN><U><SPAN style="FONT-SIZE: 7.5pt; COLOR: blue; FONT-FAMILY: Arial"><A 
  href="http://www.stadtplan-zittau.de/?alias=idu">http://www.stadtplan-zittau.de/?alias=idu</A><o:p></o:p></SPAN></U></P></DIV>
  <DIV>&nbsp;</DIV></BLOCKQUOTE></BODY></HTML>