[postgis-users] ST_SnapToGrid returns a value out of range

Evan Martin postgresql at realityexists.net
Wed Nov 9 05:46:59 PST 2011


I've found some odd behaviour in ST_SnapToGrid, which looks like a bug. 
When I run

SELECT ST_SnapToGrid(ST_Transform(ST_GeomFromText('POINT(180 50)', 
4269), 4326), 0.00001)::geography

an error is returned:

ERROR:  Coordinate values are out of range [-180 -90, 180 90] for 
GEOGRAPHY type

Calling ST_AsText() on the same geometry returns "POINT(180 50)", as 
expected. Interestingly, if I either decrease or even increase the 
precision the error does not occur. Eg. this works fine:

SELECT ST_SnapToGrid(ST_Transform(ST_GeomFromText('POINT(180 50)', 
4269), 4326), 0.000001)::geography

It's only the value 0.0001 that seems to cause a problem. Is this a bug 
or am I missing something?

Regards,

Evan



More information about the postgis-users mailing list