[postgis-users] snapToGrid strange behaviour

Kevin Neufeld kneufeld at refractions.net
Thu Jan 26 14:25:58 PST 2006


Can somebody please explain why we are getting these results?


test=# select snaptogrid(the_geom, 0.001) ~= the_geom from tmp1; 
 ?column?  
---------- 
 f 
(1 row) 
 
test=# update tmp1 set the_geom = snaptogrid(the_geom, 0.001); 
UPDATE 1 
test=# select snaptogrid(the_geom, 0.001) ~= the_geom from tmp1; 
 ?column?  
---------- 
 f 
(1 row)  



OR




test=# SELECT a.geom,
test-#        b.geom,
test-#        asText(a.geom),
test-#        asText(b.geom),
test-#        equals(a.geom, b.geom),
test-#        a.geom ~= b.geom
test-# FROM (SELECT snapToGrid('POINT(1.23456789 9.87654321)'::geometry, 
0.001) AS geom) AS a,
test-#      (SELECT snapToGrid(snapToGrid('POINT(1.23456789 
9.87654321)'::geometry, 0.001), 0.00001) AS geom) AS b;
-[ RECORD 1 ]----------------------------------------
geom     | 0101000000C3F5285C8FC2F33F1B2FDD2406C12340
geom     | 0101000000C3F5285C8FC2F33F1B2FDD2406C12340
astext   | POINT(1.235 9.877)
astext   | POINT(1.235 9.877)
equals   | t
?column? | t

test=# SELECT a.geom,
test-#        b.geom,
test-#        asText(a.geom),
test-#        asText(b.geom),
test-#        equals(a.geom, b.geom),
test-#        a.geom ~= b.geom
test-# FROM (SELECT snapToGrid('POINT(1.23456789 9.87654321)'::geometry, 
0.001) AS geom) AS a,
test-#      (SELECT snapToGrid(snapToGrid('POINT(1.23456789 
9.87654321)'::geometry, 0.001), 0.000001) AS geom) AS b;
-[ RECORD 1 ]----------------------------------------
geom     | 0101000000C3F5285C8FC2F33F1B2FDD2406C12340
geom     | 0101000000C2F5285C8FC2F33F1A2FDD2406C12340
astext   | POINT(1.235 9.877)
astext   | POINT(1.235 9.877)
equals   | f
?column? | f



Cheers,
Kevin

-- 
Kevin Neufeld,
Refractions Research Inc.,
kneufeld at refractions.net
Phone: (250) 383-3022 
Fax:   (250) 383-2140 




More information about the postgis-users mailing list