[postgis-users] snapToGrid strange behaviour

Kevin Neufeld kneufeld at refractions.net
Thu Jan 26 14:27:40 PST 2006


One more thing...
test=# select postgis_full_version();
                           postgis_full_version                          
--------------------------------------------------------------------------
 POSTGIS="1.1.1CVS" GEOS="2.1.1" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS
(1 row)


Kevin Neufeld wrote:

> 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