[Qgis-developer] please help me write a QGIS-PostGIS GUI in Python

Maciej Sieczka tutey at o2.pl
Tue Feb 5 14:51:52 EST 2008


Hi

I've made the whole thing functional enough to use it I think. I can't 
make the TreeView selector work, but anyway. The outline of current 
functionality of the attached code:

1. Re-use PostgreSQL connections defined from the QGIS "Add PostGIS 
Table(s)" dialog.
2. Support schemas available within the database, skipping PostgreSQL 
reserved ones.
3. Create a new layer. Let setting the layer name, index column name 
(forces "serial" datatype), geometry column name, geometry type (only 
multi-point,-line,-polygon as of now; are their "simple" counterparts 
and GEOMETRYCOLLECTION neccessary, please extend the script) and SRID. 
Create a GiST index on the new layer (hardcoded; modify if neccesary).

I didn't make it on time to let columns be removed/added. Luckily this 
can be done from the "table editor" after one adds the newly created 
PostGIS layer to his project.

I wish to extend the plugin with this functionality. As well as allowing 
for removing tables, managing database connections and letting choose 
coordinate system from the QGIS projection dialog instead of giving a 
plain SRID number.

PROBLEMS:

1. I don't know why actions tied to my GUI buttons are performed twice 
most of the times (always?). There is sane error handling underneath 
(within the script and PostgreSQL itself) so nothing nasty takes place, 
but it's very annoying. Ideas why and how to solve this are welcome.

2. How to catch non-PostgreSQL compliant table and column names in the 
script best? Currently only psycopg catches them at it's own and returns 
the error from Postgres, but is not informative enough sometimes for an 
average user.

Lot's of thanks to Alessandro for sharing his code, which was a great 
support, Barry and Gary for their help and patience.

Maciek

-------------- next part --------------
A non-text attachment was scrubbed...
Name: create_postgis_layer.tar.bz2
Type: application/x-bzip
Size: 9378 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/qgis-developer/attachments/20080205/b43c1ffd/create_postgis_layer.tar.bin


More information about the Qgis-developer mailing list