[postgis-users] Longitude and latitude ranges

12 views
Skip to first unread message

Jaime Casanova

unread,
Aug 22, 2011, 7:22:37 PM8/22/11
to PostGIS Users Discussion
Hi,

after some tries, i haven't managed to make this query use the GiST
index that was created on columns transmitter_mv.punto nor
rowlatlong.punto and it finishes using a seq scan on table
transmitter_mv for every row in rowfreqlevel that satisfies the join
and where conditions.

Stephen Woodbridge, made me notice in
http://postgis.refractions.net/pipermail/postgis-users/2011-August/030575.html
that in the plan the POINT is being casted to geography so i decided
to bite the bullet and use geography columns intead but when i tried
to create the points from long/lat pairs i got this error (which i
didn't get when the column was geometry)
"""
db=# update transmitter_mv set punto = st_makepoint(tx_long, tx_lat);
ERROR: Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type
"""

any ideas why this is happening?

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación
_______________________________________________
postgis-users mailing list
postgi...@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Jaime Casanova

unread,
Aug 25, 2011, 1:35:37 PM8/25/11
to PostGIS Users Discussion
On Mon, Aug 22, 2011 at 6:22 PM, Jaime Casanova <ja...@2ndquadrant.com> wrote:
> Hi,
>
> after some tries, i haven't managed to make this query use the GiST
> index that was created on columns transmitter_mv.punto nor
> rowlatlong.punto and it finishes using a seq scan on table
> transmitter_mv for every row in rowfreqlevel that satisfies the join
> and where conditions.
>
> Stephen Woodbridge, made me notice in
> http://postgis.refractions.net/pipermail/postgis-users/2011-August/030575.html
> that in the plan the POINT is being casted to geography so i decided
> to bite the bullet and use geography columns intead but when i tried
> to create the points from long/lat pairs i got this error (which i
> didn't get when the column was geometry)
> """
> db=# update transmitter_mv set punto = st_makepoint(tx_long, tx_lat);
> ERROR:  Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type
> """
>

btw, this is obviously postgis 1.5 and postgres version (less obvious) is 9.0

Ture Pålsson

unread,
Aug 26, 2011, 2:29:16 AM8/26/11
to PostGIS Users Discussion
2011/8/23 Jaime Casanova <ja...@2ndquadrant.com>:

> db=# update transmitter_mv set punto = st_makepoint(tx_long, tx_lat);
> ERROR:  Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type
> """
>
> any ideas why this is happening?

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?

-- T

Jaime Casanova

unread,
Aug 29, 2011, 3:14:52 PM8/29/11
to PostGIS Users Discussion
On Fri, Aug 26, 2011 at 1:29 AM, Ture Pålsson <ture.p...@gmail.com> wrote:
> 2011/8/23 Jaime Casanova <ja...@2ndquadrant.com>:
>
>> db=# update transmitter_mv set punto = st_makepoint(tx_long, tx_lat);
>> ERROR:  Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type
>> """
>>
>> any ideas why this is happening?
>
> 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

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación

Ben Madin

unread,
Aug 29, 2011, 8:33:03 PM8/29/11
to PostGIS Users Discussion
Jaime,

On 23/08/2011, at 7:22 AM, Jaime Casanova wrote:

> after some tries, i haven't managed to make this query use the GiST
> index that was created on columns transmitter_mv.punto nor
> rowlatlong.punto and it finishes using a seq scan on table
> transmitter_mv for every row in rowfreqlevel that satisfies the join
> and where conditions.
>
> Stephen Woodbridge, made me notice in
> http://postgis.refractions.net/pipermail/postgis-users/2011-August/030575.html
> that in the plan the POINT is being casted to geography so i decided
> to bite the bullet and use geography columns intead but when i tried
> to create the points from long/lat pairs i got this error (which i
> didn't get when the column was geometry)
> """
> db=# update transmitter_mv set punto = st_makepoint(tx_long, tx_lat);
> ERROR: Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type
> """
>
> any ideas why this is happening?

It may help... it may of course not ... to set the SRID of the Geometry when you make the point, vis

> db=# update transmitter_mv set punto = st_setSRID(st_makepoint(tx_long, tx_lat), mysrid);

where mysrid matches the projection you selected for the column punto ?4326?

It would really help you if you are getting few responses to put a short repeatable example of your process and a subset of data that causes the problem. You can probably put few enough points to make it unidentifiable, or even shift them (as long as you are still getting the problem) if you are worried about privacy issues.

cheers

Ben

Ture Pålsson

unread,
Aug 30, 2011, 2:11:05 AM8/30/11
to PostGIS Users Discussion
2011/8/29 Jaime Casanova <ja...@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

Reply all
Reply to author
Forward
0 new messages