Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a table in postgis like this

CREATE TABLE locations (id int, name VARCHAR(255), pos geography(POINT, 4326));

with a couple of points. E.G.

INSERT INTO locations (name, pos) VALUES ('freiburg', ST_GeographyFromText('POINT(7.86 48.0)'));

But importing the table as a layer in Qgis results in multiple errors

st_asbinary(st_force_2d("pos"::geometry),'NDR'),"id" FROM 
"public"."locations" WHERE "pos" && st_makeenvelope(-180,-90,180,90,4326) 
returned 7 [ERROR:  Invalid geography. Antipodal (180 degrees long) edge 
(180 -90,180 90) detected, add a point between to make two edges that span 
less than 180 degrees.]

and nothing gets drawn.

My QGis is 1.9.0, postgis 2.0.3

share|improve this question
Is your id field a primary key or a unique index? – DPierce Sep 4 '13 at 13:34
@DPierce: Im my example it is just a int field. As I thought it's non relevant to my problem. Anyway, using 'serial' or omitting the column completely does not make the error go away. I just gave it a try. – Volker Sep 4 '13 at 13:45
I'll admit that it seems eroneous, but QGIS requires a unique non-null fields for PostGIS queries. Have you check to make sure nothing in the table has an anti-podal points? Those are banned in PostGIS. – DPierce Sep 4 '13 at 15:09
Thanks for the tip about the unique field. I have narrowed my data down to that one entry. I think the error is not in my data but in the st_makeenvelope(...) call QGIS uses to grab all data. – Volker Sep 4 '13 at 15:41
Pretty sure this is just a bug. See:… – DPierce Sep 4 '13 at 19:11
up vote 3 down vote accepted

Apparently this is a bug in QGIS.

Bug report

share|improve this answer
Yeah, QGIS is going to need to be a smidge smarter dealing with geography types. The world is not a rectangle. – Paul Ramsey Sep 13 '13 at 16:48
bug still crawling at v2.6 – Jay Cummins Nov 7 '14 at 16:17

Your Answer


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.