[Qgis-user] Python Geoprocessing Plugin

Paolo Cavallini cavallini at faunalia.it
Fri Mar 21 07:56:43 PDT 2008


Dr. Horst Düster ha scritto:

> mmm.... at the moment there is no documentation avaliable. What kind of
> documentation do you expect? Explanation of the different functions or
> documentation of the plugin code itself?

I think this plugin should become part of the core: too useful to miss
it! As such, its functioning should be documented in the main manual.

> I don't understand the intension of your question. Do you mean to get a
> PostGIS Layer, make an analysis like buffer  and than to store back the
> result to DB? This approach assumes write access to DB, login methods to
> DB etc. I believe that the best way is to store the geoprocessing
> results to your file system. You are free to use the SPIT plugin to
> transfer the stored results to your DB.

I think storing results on the file system is very good for many users,
but serious postgis users would prefer to run the analyses directly in
the db. We're thinking about something like:

Dialog1: Choose the name of the table(s) to run the analysis on
[list of PostGIS layers loaded into QGIS]
and the analysis to be run (buffer etc.)

Dialog2: Choose whether you want to create:
1. visualization only
2. a view
3. a table

if 1 then

select [all the fields from table_name, minus the
$geographic_field], st_buffer ([$geographic_field], [buffer_width])
from [table_name];

if 2 then

create view [table_name_buffer as a default] as select [all the fields
from table_name, minus the $geographic_field], st_buffer
([$geographic_field], [buffer_width]) from [table_name];
insert into geometry_columns values('', '[schema, as a default the
working one'], '[table_name_buffer]', 'st_buffer', 2, [srid from
original table], 'POLYGON');

if 3 then

create table [table_name_buffer as a default] as select [all the fields
from table_name, minus the $geographic_field] from [table_name];
select addgeometrycolumn('[schema, as a default the working one'],
'[able_name_buffer]', 'st_buffer', [srid from original table],
'POLYGON', 2);
update [table_name_buffer] set
st_buffer=st_buffer([$geographic_field], [buffer_width]);

In principle this should be reasonably simple, as it is only a matter of
passing the commands+credentials to the db (see eg the "New PostGIS
layer" plugin for an example).

I'm not saying *you* should code this, just that *if* someone is willing
to, he would better do it inside your plugin rather than a separate one.
In case someone needs help with SQL commands, we're available.
All the best, and thanks for your work!
pc
-- 
Paolo Cavallini, see: http://www.faunalia.it/pc
Noi ci troviamo male con NGI http://www.ngi.it/



More information about the Qgis-user mailing list