[Gfoss] POSTGIS+QGIS

Salve a tutti, ed in particolare a Faunalia(grandi!)

stavo giocando un po con PostGIS e QGIS e ad un tratto mentre cerco di
importare il mio nuovo layer in qgis mi appare:

The table has no column suitable for use as a key.

Qgis requires that the table either has a column of type
int4 with a unique constraint on it (which includes the
primary key) or has a PostgreSQL oid column.

public.test1 (the_geom) sql= è un layer non valido e non può essere
caricato.

Praticamente ho creato un nouvo strato dall'intersezione delle strade con un
comune:

create table test1 as
select intersection(r.the_geom, l.the_geom) as geometry,
r.numero, r.tipo, r.classe
from stradegbe as r, limiti_amm as l
where r.the_geom && l.the_geom
and intersects(r.the_geom, l.the_geom)
and l.comune ='COSENZA';

Dopo aver creato con successo la tabella test1, non mi permette di
visualizzare il layer per i motivi sopradetti.

Qualcuno di voi ha mai riscontrato questo problema?
Grazie

--
View this message in context: http://www.nabble.com/POSTGIS%2BQGIS-tf2714319.html#a7567677
Sent from the Gfoss mailing list archive at Nabble.com.

Salvator*eL*arosa ha scritto:

Salve a tutti, ed in particolare a Faunalia(grandi!)

stavo giocando un po con PostGIS e QGIS e ad un tratto mentre cerco di
importare il mio nuovo layer in qgis mi appare:

The table has no column suitable for use as a key.

Qgis requires that the table either has a column of type
int4 with a unique constraint on it (which includes the
primary key) or has a PostgreSQL oid column.

public.test1 (the_geom) sql= è un layer non valido e non può essere
caricato.

Praticamente ho creato un nouvo strato dall'intersezione delle strade con un
comune:

create table test1 as
select intersection(r.the_geom, l.the_geom) as geometry,
r.numero, r.tipo, r.classe
from stradegbe as r, limiti_amm as l
where r.the_geom && l.the_geom
and intersects(r.the_geom, l.the_geom)
and l.comune ='COSENZA';

Dopo aver creato con successo la tabella test1, non mi permette di
visualizzare il layer per i motivi sopradetti.

Non uso qgis, ma l'overlay che hai fatto sopra deve essere completato
con un po' di cosette per renderlo una buona tabella postgis:
* alter table per assegnare una chiave primaria alla tabella (credo
   tu possa aggiungere un campo di tipo serial)
* registrazione della tabella in geometry_columns in modo che postgis
   sappia quali colonne geometriche ci sono, in che sistema di
   referimento sono definite, eccetera.
* magari, ma non streattamente necessario, creare un indice spaziale
   sulla geometria in modo che le query di visualizzazione vadano
   un po' più veloce.

Poi QGis dovrebbe essere contento (a quel punto sono come le tabelle
che importi con shp2pgsql...)

Ciao
Andrea

Andrea Aime-3 wrote:

Salvator*eL*arosa ha scritto:

Salve a tutti, ed in particolare a Faunalia(grandi!)

stavo giocando un po con PostGIS e QGIS e ad un tratto mentre cerco di
importare il mio nuovo layer in qgis mi appare:

The table has no column suitable for use as a key.

Qgis requires that the table either has a column of type
int4 with a unique constraint on it (which includes the
primary key) or has a PostgreSQL oid column.

public.test1 (the_geom) sql= è un layer non valido e non può essere
caricato.

Praticamente ho creato un nouvo strato dall'intersezione delle strade con
un
comune:

create table test1 as
select intersection(r.the_geom, l.the_geom) as geometry,
r.numero, r.tipo, r.classe
from stradegbe as r, limiti_amm as l
where r.the_geom && l.the_geom
and intersects(r.the_geom, l.the_geom)
and l.comune ='COSENZA';

Dopo aver creato con successo la tabella test1, non mi permette di
visualizzare il layer per i motivi sopradetti.

Non uso qgis, ma l'overlay che hai fatto sopra deve essere completato
con un po' di cosette per renderlo una buona tabella postgis:
* alter table per assegnare una chiave primaria alla tabella (credo
   tu possa aggiungere un campo di tipo serial)
* registrazione della tabella in geometry_columns in modo che postgis
   sappia quali colonne geometriche ci sono, in che sistema di
   referimento sono definite, eccetera.
* magari, ma non streattamente necessario, creare un indice spaziale
   sulla geometria in modo che le query di visualizzazione vadano
   un po' più veloce.

Poi QGis dovrebbe essere contento (a quel punto sono come le tabelle
che importi con shp2pgsql...)

Ciao
Andrea

_______________________________________________
Gfoss mailing list
Gfoss@faunalia.com
http://www.faunalia.com/cgi-bin/mailman/listinfo/gfoss

Grazie mille adesso funziona, mancava la PK.....
L'indice lo posso creare anche senza PK vero? perchè avevo già fattp create
index--------
--
View this message in context: http://www.nabble.com/POSTGIS%2BQGIS-tf2714319.html#a7568840
Sent from the Gfoss mailing list archive at Nabble.com.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Confermo, ci vuole un campo int4 su cui sia stata definita una primary
key. Occhio che PostgreSQL 8 di defaunlt non ha gli oid.
pc

Salvator*eL*arosa ha scritto:

Salve a tutti, ed in particolare a Faunalia(grandi!)

stavo giocando un po con PostGIS e QGIS e ad un tratto mentre cerco di
importare il mio nuovo layer in qgis mi appare:

The table has no column suitable for use as a key.

Qgis requires that the table either has a column of type
int4 with a unique constraint on it (which includes the
primary key) or has a PostgreSQL oid column.

...
- --
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy Tel: (+39)348-3801953
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFa+H6/NedwLUzIr4RAo5RAJ4ipteWW0SevQYDvUAu3RqXFQo0PgCgsJJV
MtcS8VVVW9eJK5Ph7vxyXZE=
=wwWE
-----END PGP SIGNATURE-----