Hi Horst, Thanks for providing this useful plugin.
Following the discussion I suggest that you try using the MemoryProvider instead of Shapefiles. In many cases, one doesn't want to store the results of the query - so the memory provider would be a good place for the temporary storage of the result. If the user wants to store the results he can still write it to a shapefile or to Postgis. Here is some sample code for the MemoryProvider: http://wiki.qgis.org/qgiswiki/PythonBindings (search for memory provider) I haven't used it myself, but it looks like a perfect thing to use for your plugin. Andreas On Thu, March 12, 2009 9:25 pm, Düster Horst wrote: > John, > > I created the plugin due to the lack of possibility to visualize PostGIS > SQL Queries with resultant tables containing geometry columns. In > principle it should have a similar behaviour like the PgAdmin3 SQL > Editor. With the difference that the new plugin creates a geographical > view at the result too. > > Mini docmentation: > 1. You have to define a PostGIS connection with the PostGIS Connector > 2. When you start the plugin for the first time, it will ask for a > temp-path because it has to store the resultant shape files into a > directory. For further sessions this directory will be used until you > change it with the ... button > 3. select the former defined PostGIS connectin > 4. Under the assumption you have a PostGIS Table called example with one > geometry-column you can use the plugin to execute the following query: > > select * from example > > when you hit the execute button or alternatively F5 the query is > executed and it produces a shape-file with the query result. But my > simple example doesn't make much sense. The use of the plugin makes > sense when you develop complex queries with joins, aggregations, filter, > functions etc. In this case you are able to develop your query and to > view the result directly and very easy. I think it is very helpful. > >>Also, the plugin asks for a temporary directory to store files in, but > it seems that you need a permanent directory to work from. This is where > I am confused. Is this meant to perform queries on >existing postgis > tables, or is it meant to query a shapefile and then load it into > postgis? If the former, how does it improve on adding a postgis layer > and performing the query there? > In many cases when you develop spatial queries it is helpful to see the > result directly. Thus you have to save the query-result temporarily many > times until you have finished the development process. Than you can take > your query and make a view from it into the database, which you can load > directly from PostGIS via Postgres connector of course. The idea is to > have a developement tool it is not the idea to create persistent > queries. If you like to save your temporary query result to a non > temporary place, please use the QGIS save as shapefile command. > > I hope that the intension and the use of the plugin will be a little > more precised. > > Regrads > Horst > > > ------------------------------------------------ > > Dr. Horst Düster > Stv. Amtschef / GIS-Koordinator > > Kanton Solothurn > Bau- und Justizdepartement > Amt für Geoinformation > SO!GIS Koordination > Rötistrasse 4 > CH-4501 Solothurn > > Telefon ++41(0)32 627 25 32 > Telefax ++41(0)32 627 22 14 > > mailto:[email protected] > http://www.agi.so.ch > > > > -----Ursprüngliche Nachricht----- > Von: John C. Tull [mailto:[email protected]] > Gesendet am: Donnerstag, 12. März 2009 17:47 > An: Düster Horst > Cc: qgis-user > Betreff: Re: [Qgis-user] New PostGIS SQL Query Editor Plugin > > > Düster, > > Do you have any documentation on how to use this? I gave it a go this > morning, but a simple query statement did not work. What would be a > snippet that would work in the query editor given that one has a > table called "example" in a database called postgis with public > schema on a local server? > > > Also, the plugin asks for a temporary directory to store files in, > but it seems that you need a permanent directory to work from. This > is where I am confused. Is this meant to perform queries on existing > postgis tables, or is it meant to query a shapefile and then load it > into postgis? If the former, how does it improve on adding a postgis > layer and performing the query there? > > Cheers, > John > > On Mar 12, 2009, at 1:36 AM, Düster Horst wrote: > > > > I just uploaded the new PostGIS SQL Query Editor Plugin to the > QGIS User-Contributed Python Plugin Repository. The aim of the > plugin is to edit and perform any spatial PostGIS query from an > editor environment. After successful execution of a query the > result will be loaded from shape file to MapCanvas. The plugin > works provided that pgsql2shp is installed and the path to > pgsql2shp is defined in the system PATH environment. > > I hope that the plugin will be helpful for you. I'm looking > forward for any comment. > > Regards > > Dr. Horst Düster > Stv. Amtschef / GIS-Koordinator > > Kanton Solothurn > Bau- und Justizdepartement > Amt für Geoinformation > SO!GIS Koordination > Rötistrasse 4 > CH-4501 Solothurn > > Telefon ++41(0)32 627 25 32 > Telefax ++41(0)32 627 22 14 > > mailto:[email protected] > http://www.agi.so.ch > > _______________________________________________ > Qgis-user mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-user > > > > > > > _______________________________________________ > Qgis-user mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-user > -- Andreas Neumann http://www.carto.net/neumann/ http://www.svgopen.org/ _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user
