[postgis-users] Strange behaviour with st_difference

Mike Leahy mgleahy at alumni.uwaterloo.ca
Tue Jan 13 00:04:41 PST 2009

Hello list,

I'm having a problem with st_difference, where two overlapping 
geometries will return an empty geometrycollection, as if the do not 
overlap.  However, if I use st_difference on the same geometries, but 
converted to EWKT, then back, then using st_difference yields the 
expected output.  Basically, this is what I'm getting (minus the output 

# select st_astext(st_difference(g1,g2)), 
st_astext(st_difference(st_asewkt(g1),st_asewkt(g2))) from temp;
         st_astext         |  st_astext
(1 row)

The resulting (correct) polygon is very small (a total area of 
0.00048828125, using UTM coordinates), so maybe there's a problem with 
that?  The result of st_overlaps(g1,g2) is true for the same data that 
cause this problem.

I could email someone the geometries if that would help.


More information about the postgis-users mailing list