I am attempting to convert a geometry column in the postgres database to a geography column. I created a new column like this:

alter table scene add column footprint_new geography(POLYGON, 4326);

and I'm trying to populate the new column like so:

update scene set footprint_new = footprint::geography;

and I get the following error:

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

Now, it isn't too surprising that there are some out of range values in this database. I want to skip those out of range geometries during the update and identify them later so they can be fixed. How can I do that?

  • You really shouldn't end up with any values that are out of range. The Geography column has Latitude/Longitude values that cover the entire globe. It seems like the problem is you need to apply some sort of transformation to convert your coordinates properly. What projection are your input features in? – Get Spatial Jun 22 '12 at 16:04


update scene set footprint_new = footprint::geography where st_covers(st_makeenvelope(-180, -90, 180, 90, 4326), footprint)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.