[geos-devel] GEOS returning invalid geometries

Martin Davis mbdavis at VividSolutions.com
Fri Sep 17 15:47:35 EDT 2004


I wonder if this is due to floating-point implementation issues?  Being
build on Java, JTS has the luxury of being able to assume that all
floating point is carried out in IEEE754.  GEOS on the other hand is
dependent on the underlying compiler (and presumably processor FPU).

I can't think of any explicit dependencies in JTS/GEOS which would cause
this, but if another floating point model is used it's possible that
some computations could come out slightly differently.    

The place I would start looking is the line intersection computation in
RobustLineIntersector.  Try intersecting the line segments which
determine the erroneous point, and see what answer they give.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.      www.vividsolutions.com
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046


> -----Original Message-----
> From: Carl Anderson [mailto:carl.anderson at vadose.org] 
> Sent: September 16, 2004 4:51 PM
> To: geos-devel at geos.refractions.net
> Cc: postgis-devel at postgis.refractions.net
> Subject: [geos-devel] GEOS returning invalid geometries
> 
> 
> 
> I just stumbled on an issue that in Postgis/GEOS.
> 
> in Pg
> 
> select difference(a.shape,b.shape)   (shapes,script attached )
> 
> returns:
>    1)   invalid geometry
>    2)   different results than JUMP 1.1.2
> 
> Notice the first ring has the same coords in the 1st, 3rd and 
> 5th vertex.
> 
> Notice the second ring is equally bad.
> 
> postgresql 7.4.5, Postgis 9.0, Geos 2.0
> I changed
>    geosInit in Postgis to explicitly declare FLOATING
> with no change.
> 
> postgis result
> 
> MULTIPOLYGON (((
>             2149664.15952312 1302059.43445874,
>             2149522.80170403 1302723.18036188,
>             2149664.15952312 1302059.43445874,
>             2149720.712 1302078.1109,
>             2149664.15952312 1302059.43445874
>         )), ((
>             2153145.9794 1304923.3463,
>             2153267.92794731 1305161.93238453,
>             2153267.92794731 1305161.93238453,
>             2153145.9794 1304923.3463
>         )))
> 
> jump result
> 
> MULTIPOLYGON (((
>             2149664.1595231155 1302059.4344587359,
>             2149522.80170403 1302723.18036188,
>             2149664.15952312 1302059.43445874,
>             2149720.712 1302078.1109,
>             2149664.1595231155 1302059.4344587359
>         )), ((
>             2153145.9794 1304923.3463,
>             2153267.92794731 1305161.93238453,
>             2153267.9279473107 1305161.93238453,
>             2153145.9794 1304923.3463
>         )))
> 
> 
> poking into GEOS, for a solution now.
> 
> 
> C.
> 
> 
> Carl Anderson
> 
> 



More information about the geos-devel mailing list