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 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

Query: DECLARE qgisf0_0 BINARY CURSOR FOR SELECT 
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: osgeo-org.1560.x6.nabble.com/… –  DPierce Sep 4 '13 at 19:11
show 1 more comment

1 Answer

up vote 1 down vote accepted

Apparently this is a bug in QGIS.

Bug report http://hub.qgis.org/issues/8572

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
add comment

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.