[postgis-users] geometry field doesn't show up in gvSig
Picavet Vincent
Vincent.Picavet at mediapost.fr
Fri Oct 31 05:21:42 PDT 2008
Hello,
> Hi,
> I have apostgis table that I can load in qgis but I can't
> with gvSig. In gvSig the Geometry field list box is empty so
> I can not complete the GeoBD wizard.
For gvSIG to be able to read a table with a geometry field, there must
be an entry for this field in the postgis geometry_columns table.
Therefore, you have a few different solutions (with the first one
preferred) :
* Use postgis addgeometrycolumn function to add you geometry column
after the table creation. It will add the entry into geometry_colums and
add the right constraints on your table too.
See
http://postgis.refractions.net/documentation/manual-1.3/ch06.html#id2988
795
* Manually add an entry in geometry_columns. For exemple :
insert into geometry_columns (
f_table_catalog
, f_table_schema
, f_table_name
, f_geometry_column
, coord_dimension
, srid
, "type")
values ('', 'public', 'mytable', 'the_geom', 2, 27582, 'LINESTRING');
See :
http://postgis.refractions.net/documentation/manual-1.3/ch04.html#id2985
911
* There are also functions dedicated to adding entries in the
geometry_columns table scanning tables with specific constraints or
geometry fields. Available only in latest postgis versions. See :
http://postgis.refractions.net/documentation/manual-svn/Probe_Geometry_C
olumns.html
http://postgis.refractions.net/documentation/manual-svn/Populate_Geometr
y_Columns.html
Good luck
Vincent
> I tried with other tables and it works. Maybe the way I
> created this table is not correct. Here is what I did:
> in the sql below ad2001 is a table with a geometry field
> visible in gvSig
> defavorisation2001 is a table without geometry I made a join
> from these 2 tables. Do you something wrong in the creation
> of this new table?
> thanks,
> steve
>
> select distinct a.gid, a.the_geom, b."ADIDU", b."QUINTMAT",
> b."QUINTSOC"
> into lim_admin.IndiceDefavorisation
> from lim_admin.ad2001 as a, lim_admin. defavorisation2001 as
> b where a."dauid" = b."ADIDU";
>
> alter table lim_admin.IndiceDefavorisation add CONSTRAINT
> IndiceDefavorisation_pkey PRIMARY KEY (gid), --add column
> idUnique serial PRIMARY KEY, add CONSTRAINT
> enforce_dims_the_geom CHECK (ndims(the_geom) = 2), add
> CONSTRAINT enforce_geotype_the_geom CHECK
> (geometrytype(the_geom) = 'MULTIPOLYGON'::text OR the_geom IS
> NULL), add CONSTRAINT enforce_srid_the_geom CHECK
> (srid(the_geom) = 4326);
>
> CREATE INDEX IndiceDefavorisation_the_geom_gist
> ON lim_admin.IndiceDefavorisation
> USING gist
> (the_geom);
> --
> View this message in context:
> http://www.nabble.com/geometry-field-doesn%27t-show-up-in-gvSi
> g-tp20264514p20264514.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
>
> _______________________________________________
> 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