[postgis-users] PostGIS table doesn't show up in QGIS

Mr. Puneet Kishor punk.kish at gmail.com
Wed Sep 14 20:10:13 PDT 2011


On Sep 14, 2011, at 9:41 PM, Ben Madin wrote:

> Puneet,
> 
> Not uncommon problem - QGIS looks in the Geometry_columns table - you might want to check that the geometry column is registered in this table. If not you can run :
> 
> SELECT Populate_Geometry_Columns(); -- for all tables
> 
> or
> 
> SELECT Populate_Geometry_Columns('public.myspatial_table'::regclass); -- for myspatial_table
> 
> http://postgis.refractions.net/documentation/manual-1.5/Populate_Geometry_Columns.html
> 
> Note that using AddGeometryColumns() does this, but it can be corrupted. Importing tables doesn't do this automagically.



That was it Ben. Thanks. I had written a Perl program to load a sackful of data tables, and then combined them to make a seamless table. Doing so didn't create the correct row in the geometry_columns table.

Now I know.


> 
> cheers
> 
> Ben
> 
> 
> 
> 
> 
> 
> On 15/09/2011, at 10:07 AM, Puneet Kishor wrote:
> 
>> This happens from time to time... I have a table like so
>> 
>> CREATE TABLE foo
>> (
>> gid serial NOT NULL,
>> the_geom geometry,
>> CONSTRAINT foo_pk PRIMARY KEY (gid ),
>> CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2),
>> CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 4326)
>> )
>> WITH (
>> OIDS=FALSE
>> );
>> 
>> ALTER TABLE foo
>> OWNER TO postgres;
>> 
>> CREATE INDEX foo_geom_idx
>> ON states
>> USING gist
>> (the_geom );
>> 
>> Yet, the above table doesn't show up in QGIS open dialog. If I check the box to show tables with no geometry, then the above table shows up as not having any geometry. The table has 20K+ rows, and while a few rows have invalid geometry, for the most part, the table has good data in it.
>> 
>> What is the reason for the above?
>> 
>> Puneet.
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 




More information about the postgis-users mailing list