Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
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

1 Answer 1

up vote 3 down vote accepted

Try:

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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