I am trying to display data held in the PostGIS Geography type on a map in QGIS. Whatever I do I can't get it to work.
Here is the SQL that creates my data - a single point in London.
CREATE TABLE test_srid.world_points
(
id serial NOT NULL,
name character varying(150),
geog_point geography(Point,4326),
CONSTRAINT world_points_pkey PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE test_srid.world_points
OWNER TO postgres;
CREATE INDEX idx_world_points_geog_point
ON test_srid.world_points
USING gist
(geog_point);
INSERT INTO test_srid.world_points (name, geog_point) VALUES ('my_address', ST_GeogFromText('SRID=4326;POINT(0.1275 51.5072)') );
QGIS recognises this as a layer, but does not display any data:
I have found this which seems to suggest that the geography type is supported.
I've checked that the data in PostGIS is working correctly: I've created two points using code similar to the above, and run the following query:
SELECT ST_Distance(a.geog_point,b.geog_point)
from test_srid.world_points as a,
test_srid.world_points as b
where a.id = 1 and b.id=2
The result came back as expected (I double checked against google maps).
Is there a setting I need to change to get this to work?
I was initially working with QGIS Brighton, but upgraded to Wien to check it wasn't anything to do with my QGIS version.
Data in geometry datatypes displays with no issue.
CREATE EXTENSION PostGIS
; is run, which should be equivalent (according to gis.stackexchange.com/questions/26508/…). Any ideas?