[postgis-users] Longitude and latitude ranges

Ture Pålsson ture.palsson at gmail.com
Mon Aug 29 23:11:05 PDT 2011


2011/8/29 Jaime Casanova <jaime at 2ndquadrant.com>:
>> Perhaps this is a too-obvious question, but have you made sure that
>> you don't have some "bad" point, with latitude and/or longitude out of
>> range, that has somehow sneaked into your data set?
>>
>
> if i create geometry points it works like a charm, so i don't think so

The geometry datatype does very little in terms of sanity checks, it
will happily let you create all sorts of bizarre coordinates:

idf=> select st_asewkt(st_setsrid(st_makepoint(1000, 1000), 4326));
        st_asewkt
----------------------------
SRID=4326;POINT(1000 1000)
(1 row)


However, try to cast one of those to geography, and you're in trouble:

idf=> select st_asewkt(st_setsrid(st_makepoint(1000, 1000), 4326))::geography;
ERROR:  Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type

 -- T



More information about the postgis-users mailing list