Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Larry Shaffer
Hi Jürgen,

On Fri, Aug 29, 2014 at 4:08 AM, Jürgen E.  wrote:

> Hi Pirmin,
>
> On Fri, 29. Aug 2014 at 10:24:00 +0200, Pirmin Kalberer wrote:
> > This looks like the first real case for an RFC! I'm quite sceptical
> adding
> > Python to QGIS server. In my opinion this should be discussed thoroughly
> > first.
>
> I recently spend some time exploring the server side expecially QWC - or
> other
> options.  If I didn't know before, I'd now know why it's called "web".
> Frameworks over frameworks in countless languages.Some frameworks are
> are quite similar, some are clones or heavily inspired by others, just
> implementend in a different languages.   You can't explore them all, but
> you
> can choose without exploring either.  Really frustrating.
>
> News to me was that javascript is apparently also heavily used on the
> server
> side based on node.js.  So more clones and alternatives on the server side
> to
> choose from.
>
> And we have javascript in Qt.  There's even a generator that builds Qt
> bindings
> for javascript.  If that could also be done for QGIS bindings, we could
> have
> plugins in javascript.   And those could work on desktop, server and
> android.
>
> But that's just an idea that striked me - exploring it would have
> sidetracked
> me even more, so I didn't.   Anyway - maybe good enough to share it.
>
> No links.  I just tried to lookup qt bindings generator I mentioned and
> found a
> qt binding generator for node.js instead - example on the frontpage a
> message
> box - message box on the server side?  No, I'll stop here, no more
> exploration
> for now. ;)
>

But wait, there's more! :-) (Sorry, off-topic.)

Yesterday, I came across the Duktape [0] embeddable JavaScript engine,
recommended by the osgEarth project as a new dependency [1].

It has a very small footprint and simple implementation. Not sure how that
would work with Qt, or even if it is needed beyond Qt's JavaScript
generator, engine, etc. Just found it interesting.

Could be used to directly integrate things like d3.js [2] or node.js
without the extra interface through Qt's QScript or QWebPage? (Just
guessing there.)

If/when QGIS's code base has been updated to Qt5, JavaScript will become
readily available as a scripting solution as well.

[0] http://duktape.org/
[1] http://docs.osgearth.org/en/latest/startup.html#get-the-dependencies
[2] http://d3js.org/ , http://bost.ocks.org/mike/map/

Regards,

Larry


>
>
> Jürgen
>
> --
> Jürgen E. Fischer   norBIT GmbH Tel. +49-4931-918175-31
> Dipl.-Inf. (FH) Rheinstraße 13  Fax. +49-4931-918175-50
> Software Engineer   D-26506 Norden
> http://www.norbit.de
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iD8DBQFUAFEOc/GhTF5ESHURAgk0AJ94Z4mAz3NGtmwY1Hphe413VfxCSQCgxXPc
> MDoNlMIc6/N1kkTUwJsnpDs=
> =cCLx
> -END PGP SIGNATURE-
>
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Alessandro Pasotti
2014-08-29 18:05 GMT+02:00 René-Luc Dhont :
>
> Le 29/08/2014 16:54, Alessandro Pasotti a écrit :
>
>> 2014-08-29 16:39 GMT+02:00 René-Luc Dhont :
>>>
>>> Hi Alessandro
>>>
>>> Thanks for this interesting input.
>>> I'm happy to test it and to develope some use case.
>>> I thought it's a good feature and can help to enhance QGIS-Server easily
>>> :
>>> WPS, WMTS, Table Join Service, WFS2 or other that OGC does not already
>>> know.
>>>
>>> Regards,
>>> René-Luc
>>>
>>>
>> Hello René-Luc,
>>
>> I'm happy to hear that you are going to test it, please let me know how it
>> goes!
>>
>> Keep in mind that it's just a proof of concept, and yes, we need a RFC
>> or QEP: the current implementation is the simplest, less obtrusive and
>> quickest that I could think about.
>>
>> For example, I would consider adding real signals attached to plugins
>> slots and cached parsed projects passed to plugin instances...
>>
>> I'm currently working on a WPS server plugin that bridges Processing
>> and PyWPS (version 3.2.2 since the latest version 4 is tightly bound
>> to werkzeug), now fighting with parameters but it basically works.
>
>
> Can I help ?
>
> I already done some works on it !


Sure!

Better have an IRC/gmail talk.

I'll try to polish a bit the code and upload what I've done so far.

Currently the biggest problem seems that process.Popen on grass
commands hangs :(



-- 
Alessandro Pasotti
w3:   www.itopen.it
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread René-Luc Dhont


Le 29/08/2014 16:54, Alessandro Pasotti a écrit :

2014-08-29 16:39 GMT+02:00 René-Luc Dhont :

Hi Alessandro

Thanks for this interesting input.
I'm happy to test it and to develope some use case.
I thought it's a good feature and can help to enhance QGIS-Server easily :
WPS, WMTS, Table Join Service, WFS2 or other that OGC does not already know.

Regards,
René-Luc



Hello René-Luc,

I'm happy to hear that you are going to test it, please let me know how it goes!

Keep in mind that it's just a proof of concept, and yes, we need a RFC
or QEP: the current implementation is the simplest, less obtrusive and
quickest that I could think about.

For example, I would consider adding real signals attached to plugins
slots and cached parsed projects passed to plugin instances...

I'm currently working on a WPS server plugin that bridges Processing
and PyWPS (version 3.2.2 since the latest version 4 is tightly bound
to werkzeug), now fighting with parameters but it basically works.


Can I help ?

I already done some works on it !




Regards


___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Alessandro Pasotti
2014-08-29 16:39 GMT+02:00 René-Luc Dhont :
> Hi Alessandro
>
> Thanks for this interesting input.
> I'm happy to test it and to develope some use case.
> I thought it's a good feature and can help to enhance QGIS-Server easily :
> WPS, WMTS, Table Join Service, WFS2 or other that OGC does not already know.
>
> Regards,
> René-Luc
>
>

Hello René-Luc,

I'm happy to hear that you are going to test it, please let me know how it goes!

Keep in mind that it's just a proof of concept, and yes, we need a RFC
or QEP: the current implementation is the simplest, less obtrusive and
quickest that I could think about.

For example, I would consider adding real signals attached to plugins
slots and cached parsed projects passed to plugin instances...

I'm currently working on a WPS server plugin that bridges Processing
and PyWPS (version 3.2.2 since the latest version 4 is tightly bound
to werkzeug), now fighting with parameters but it basically works.


Regards
-- 
Alessandro Pasotti
w3:   www.itopen.it
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread René-Luc Dhont

Hi Alessandro

Thanks for this interesting input.
I'm happy to test it and to develope some use case.
I thought it's a good feature and can help to enhance QGIS-Server easily 
: WPS, WMTS, Table Join Service, WFS2 or other that OGC does not already 
know.


Regards,
René-Luc


Le 28/08/2014 14:49, Alessandro Pasotti a écrit :

Hello,

as anticipated to some of you during the last HF, I've started to add
Python plugins support for the server side.

The rationale behind server plugins is doublefold: first they could
provide additional services without the need to touch the C++
codebase, second they allow for GUI-based configuration since the
server plugins are not separated from the desktop plugins (of course
the environment and permissions should be carefully configured to
allow information sharing from the desktop user to the webserver user
).

I've already coded a first working implementation and a few
proof-of-concept plugins.

The current implementation is based on the following ideas:

QGIS Python plugins can have additional metatags to specify what
SERVICE and REQUEST they expose, for example:

service=HELLO
methods=GetCapabilities,GetOutput,RemoteConsole

This plugin will respond to calls like
/cgi-bin/qgis_mapserv.fcgi?SERVICE=HELLO&REQUEST=RemoteConsole


The current implementation is pretty simple and CGI-style, whatever
the plugin prints to sdtout is captured and sent back to the client,
the return value from the method is the (optional) content type.

I would like to discuss this ideas during the next HF (or sooner), in
particular:

* I'm not happy with the current request handling and I think we need
a mehod to pass cached parsed project instances to the plugins when
needed and a better handling of HTTP headers
* I 'd like to see signals/slots implementation instead of static
function calls, but maybe it's just syntactic sugar
* from the python side, we don't have an iface to pass to the plugins,
so I'm currently stuck to @staticmethod


The code is in a branch:
https://github.com/elpaso/QGIS/tree/serverplugins

HelloServer demo plugin:
https://github.com/elpaso/qgis-helloserver
It is a test plugin and it provides a remote console (web shell),
insanely insecure DO NOT USE IN PRODUCTION!! and arbitrary python code
execution configurable through the QGIS desktop plugin GUI.

Here is a short demo of the HelloServer plugin:
http://youtu.be/ys9VVxQ8uac

Have fun !!




___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] qgis server can't enable logging

2014-08-29 Thread kimaidou
Hi,

I tried to use this environnement variable as well, but I cannot set the
log file as /var/log/apache2/QGIS_Server.log , even if I chmod and chown it
to give Apache full rights :

ls -lh /var/log/apache2/QGIS_Server.log
-rwxrwxrwx 1 www-data www-data 0 août  29 15:49
/var/log/apache2/QGIS_Server.log

If I set the file to /tmp/QGIS_Server.log with
FcgidInitialEnv QGIS_SERVER_LOG_FILE "/tmp/QGIS_Server.log"

then it works correctly and the log file is filled with data.

Any hint ?
Michael



2014-08-28 15:47 GMT+02:00 Paolo Cavallini :

> Il 28/08/2014 12:47, Uros Preloznik ha scritto:
> > Hi,
> >
> > Thanks Alessandro,  this is working now. I was trying only with SetEnv.
> I also had to
> > set QGIS_SERVER_LOG_LEVEL, otherwise the file was empty. So this is my
> setting now
> > which is working (Apache+Fcgid):
> >
> > FcgidInitialEnv QGIS_SERVER_LOG_FILE /var/tmp/qgislog.txt
> > FcgidInitialEnv QGIS_SERVER_LOG_LEVEL 0
> >
> > LogLevel 0 means that everything is logged, for debugging only.
> >
> > Is someone working on documentation? This could be included for others.
>
> Hi Uros,
> would you mind making a pull request on
> https://github.com/qgis/QGIS-Documentation
> Thanks.
>
> --
> Paolo Cavallini - www.faunalia.eu
> Corsi QGIS e PostGIS: http://www.faunalia.eu/training.html
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Performing buffering with script in PyQGIS

2014-08-29 Thread Rush_Hendrix
At my previous post I would like to add a picture to give an idea of how I
would like my new geometry produced by the intersection + buffering. The
picture is the following:
 



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Performing-buffering-with-script-in-PyQGIS-tp5159074p5159108.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Performing buffering with script in PyQGIS

2014-08-29 Thread Rush_Hendrix
At my previous post I would like to add a picture to give an idea of how I
would like my new geometry produced by the intersection + buffering. The
image is the following

 



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Performing-buffering-with-script-in-PyQGIS-tp5159074p5159106.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Alessandro Pasotti
2014-08-29 15:13 GMT+02:00 Andrea Peri :
> Another question.
> Is about the security of the environment.
>
> I don't know too well the possibility of python in a qgis project.
> But I fear that a qgis project could have some python code to start ad
> startup of the qgis project.
> This mean that the same code should be run in the server when it start
> a qgis-server instance in fcgi ?

No.

Plugin in QGIS desktop application are not bound to projects but to
the user preferences (i.e. are installed in user directory and every
single user can enable/disable/install/remove plugins independently.

The same is for the server plugins, but because the server user
doesn't normally have a user directory, the path in which plugins are
stored is configurable by some environmen variables that points the
plugins path to a directory of your choice, this can be one of the
(trusted) user's directories or whatever else you choose.

This means that you could have different FGCI server instances (apache
virtual servers, for example) that use different sets of environment
options and point to different sets of installed plugins.

As always, it's administrator's choice how to configure the
environment and secure it (choose proper permissions etc).

Up to this point, there is nothing new or special for QGIS.

For python startup code, this is simply ignored by my implementation
but it would be possible to write a server plugin that parses the
project file and executes it (not that I see anything useful in doing
that).


>
> However the more important option is
> to be able to choose to fully disable this option.

Just done.


-- 
Alessandro Pasotti
w3:   www.itopen.it
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Andrea Peri
Another question.
Is about the security of the environment.

I don't know too well the possibility of python in a qgis project.
But I fear that a qgis project could have some python code to start ad
startup of the qgis project.
This mean that the same code should be run in the server when it start
a qgis-server instance in fcgi ?

However the more important option is
to be able to choose to fully disable this option.

Thx,

A.


2014-08-29 13:18 GMT+02:00 Andrea Peri :
> OS the python usable in a fcgi environment ?
> This mean to load  and lock an instante of python forma every fcgi session
> (almost 40-60 afaik) ?
>
> A.
>
> Il 29/ago/2014 12:47 "G. Allegri"  ha scritto:
>
>>
>>
>>
>> 2014-08-29 12:23 GMT+02:00 Andrea Peri :
>>>
>>> The startuptime increase if iT should lo ad the python environment.
>>>
>>> All the best.
>>
>>
>> The startup will happen only the first time, unless you use CGI and not
>> FCGI.
>> Anyway, I proposed it a couple of years ago, but many told it was useless
>> for various reasons.
>> I think it could be useful if the plugin could affect WMS/WFS
>> request/response.
>> As an independent service I would rather use standalone python web code
>> (actually I do it this way, loading, parsing and caching the qgs project
>> and, in case, using headless QGIS APIs).
>>
>> giovanni
>>
>>>
>>> Il 29/ago/2014 12:13 "Paolo Cavallini"  ha
>>> scritto:
>>>
 Il 29/08/2014 12:09, Andrea Peri ha scritto:
 > Hi Poalo,
 >
 > How you can say that the overhead should be minimal.

 Because in that case Python does almost nothing, just passing the
 command to GDAL,
 SAGA, GRASS, or whatever.
 All the best.
 --
 Paolo Cavallini - www.faunalia.eu
 Corsi QGIS e PostGIS: http://www.faunalia.eu/training.html
 ___
 Qgis-developer mailing list
 Qgis-developer@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>>>
>>> ___
>>> Qgis-developer mailing list
>>> Qgis-developer@lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>>
>>
>> --
>> Giovanni Allegri
>> http://about.me/giovanniallegri
>> Twitter: https://twitter.com/_giohappy_
>> blog: http://blog.spaziogis.it
>> GEO+ geomatica in Italia http://bit.ly/GEOplus



-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Alessandro Pasotti
2014-08-29 13:34 GMT+02:00 Marco Hugentobler :
>> A quick question: python plugins only add an #include and two lines of
>> code in qgis_map_serv.cpp, a #ifdef SERVERPLUGINS block should be
>> enough to disable them completely, where should I add that option to
>> let cmake know about it?
>
>
> You can make an entries in CMakeLists.txt and in
> cmake_templates/qgsconfig.h.in.
> As an example, look at WITH_ORACLE and HAVE_ORACLE
>
> Regards,
> Marco

Thanks Marco,

just done:
https://github.com/elpaso/QGIS/commit/28374bffaad43513812523a2823c740b91a8343c


Regards.

-- 
Alessandro Pasotti
w3:   www.itopen.it
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


[Qgis-developer] Performing buffering with script in PyQGIS

2014-08-29 Thread marco.olive...@libero.it
I wrote a script that performs the intersection of two layers:


-the first Layer-> layer1 represents the rivers


-the second Layer-> layer2, represents a set of circular dots
 distributed in a geographical area (at each point corresponds to a 
numeric value that exceeds a threshold value)


The result of the intersection should be highlighted with an operation of 
buffering.

The new geometry formed by the intersection + buffering should look like this:




Writing from console PyQGIS I have not encountered any errors.

To see the new geometry I added new layers to the previous ones (from "add 
vector layer") but I have not seen anything new.


This is the code of my script:


from qgis.core import *

from qgis.gui import *


canvas = qgis.utils.iface.mapCanvas()


layers = canvas.layers()

layer1 = canvas.layer(0)

layer2 = canvas.layer(3) 


from qgis.analysis import * 


overlayAnalyzer = QgsOverlayAnalyzer()

overlayAnalyzer.intersection(layer1, layer2, 
"/home//Scrivania//output.shp") 


layer3 = canvas.layer(0)


geometryanalyzer = QgsGeometryAnalyzer()

geometryanalyzer.buffer(layer3, "/home//Scrivania//buffer.shp", 500, 
False, False, -1)


Tips ?Also Demo & Plugin example that I can study


I'm working with QGIS 2.4 on Win 7

Thanks in advance___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Marco Hugentobler

A quick question: python plugins only add an #include and two lines of
code in qgis_map_serv.cpp, a #ifdef SERVERPLUGINS block should be
enough to disable them completely, where should I add that option to
let cmake know about it?


You can make an entries in CMakeLists.txt and in 
cmake_templates/qgsconfig.h.in.

As an example, look at WITH_ORACLE and HAVE_ORACLE

Regards,
Marco


On 29.08.2014 12:06, Alessandro Pasotti wrote:

2014-08-29 11:56 GMT+02:00 Marco Hugentobler :

Hi Alessandro

Thanks for this interesting input. I'm happy to look at it in detail, but
need a bit of time to review it and think about it thoroughly. Also I'd like
to do some testing (e.g. run some of my internal server benchmarks here).

As a fery first 2c: Python on the server can open some interesting options
(expression functions in python, custom renderers, ...). Of course it needs
the possibility to turn python off for server.

Regards,
Marco


Thank you Marco,

I will be happy to hear about your testing results and I highly
appreciate all advice that you can give me!
I'm sure that there are many improvements that can be made to my
hack-ish proof-of-concept implementation.

A quick question: python plugins only add an #include and two lines of
code in qgis_map_serv.cpp, a #ifdef SERVERPLUGINS block should be
enough to disable them completely, where should I add that option to
let cmake know about it?





--
Dr. Marco Hugentobler
Sourcepole -  Linux & Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
marco.hugentob...@sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Andrea Peri
OS the python usable in a fcgi environment ?
This mean to load  and lock an instante of python forma every fcgi session
(almost 40-60 afaik) ?

A.
 Il 29/ago/2014 12:47 "G. Allegri"  ha scritto:

>
>
>
> 2014-08-29 12:23 GMT+02:00 Andrea Peri :
>
>> The startuptime increase if iT should lo ad the python environment.
>>
>> All the best.
>>
>
> The startup will happen only the first time, unless you use CGI and not
> FCGI.
> Anyway, I proposed it a couple of years ago, but many told it was useless
> for various reasons.
> I think it could be useful if the plugin could affect WMS/WFS
> request/response.
> As an independent service I would rather use standalone python web code
> (actually I do it this way, loading, parsing and caching the qgs project
> and, in case, using headless QGIS APIs).
>
> giovanni
>
>
>>  Il 29/ago/2014 12:13 "Paolo Cavallini"  ha
>> scritto:
>>
>> Il 29/08/2014 12:09, Andrea Peri ha scritto:
>>> > Hi Poalo,
>>> >
>>> > How you can say that the overhead should be minimal.
>>>
>>> Because in that case Python does almost nothing, just passing the
>>> command to GDAL,
>>> SAGA, GRASS, or whatever.
>>> All the best.
>>> --
>>> Paolo Cavallini - www.faunalia.eu
>>> Corsi QGIS e PostGIS: http://www.faunalia.eu/training.html
>>> ___
>>> Qgis-developer mailing list
>>> Qgis-developer@lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>>
>> ___
>> Qgis-developer mailing list
>> Qgis-developer@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>
>
>
> --
> Giovanni Allegri
> http://about.me/giovanniallegri
> Twitter: https://twitter.com/_giohappy_
> blog: http://blog.spaziogis.it
> GEO+ geomatica in Italia http://bit.ly/GEOplus
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

[Qgis-developer] Getting the current QgsComposerView in an expression builder user function

2014-08-29 Thread Alexandre Neto
Hello,

I'm working in a user function for expression builder to retrieve a x and y
values of a map extents in a print composer. The idea is to be able to use
it in label to label the map corners.

I know I can get all active (opened) composers by doing:

composers = iface.activeComposers()

It gives me a list of QgsComposerView, that I can select by the list index.
But how can I know the position of the QgsComposerView  in which I'm using
the function (by using it in a label)?

Many thanks,

Alexandre Neto
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread G. Allegri
2014-08-29 12:23 GMT+02:00 Andrea Peri :

> The startuptime increase if iT should lo ad the python environment.
>
> All the best.
>

The startup will happen only the first time, unless you use CGI and not
FCGI.
Anyway, I proposed it a couple of years ago, but many told it was useless
for various reasons.
I think it could be useful if the plugin could affect WMS/WFS
request/response.
As an independent service I would rather use standalone python web code
(actually I do it this way, loading, parsing and caching the qgs project
and, in case, using headless QGIS APIs).

giovanni


>  Il 29/ago/2014 12:13 "Paolo Cavallini"  ha
> scritto:
>
> Il 29/08/2014 12:09, Andrea Peri ha scritto:
>> > Hi Poalo,
>> >
>> > How you can say that the overhead should be minimal.
>>
>> Because in that case Python does almost nothing, just passing the command
>> to GDAL,
>> SAGA, GRASS, or whatever.
>> All the best.
>> --
>> Paolo Cavallini - www.faunalia.eu
>> Corsi QGIS e PostGIS: http://www.faunalia.eu/training.html
>> ___
>> Qgis-developer mailing list
>> Qgis-developer@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Giovanni Allegri
http://about.me/giovanniallegri
Twitter: https://twitter.com/_giohappy_
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Andrea Peri
The startuptime increase if iT should lo ad the python environment.

All the best.
 Il 29/ago/2014 12:13 "Paolo Cavallini"  ha scritto:

> Il 29/08/2014 12:09, Andrea Peri ha scritto:
> > Hi Poalo,
> >
> > How you can say that the overhead should be minimal.
>
> Because in that case Python does almost nothing, just passing the command
> to GDAL,
> SAGA, GRASS, or whatever.
> All the best.
> --
> Paolo Cavallini - www.faunalia.eu
> Corsi QGIS e PostGIS: http://www.faunalia.eu/training.html
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Paolo Cavallini
Il 29/08/2014 12:09, Andrea Peri ha scritto:
> Hi Poalo,
> 
> How you can say that the overhead should be minimal.

Because in that case Python does almost nothing, just passing the command to 
GDAL,
SAGA, GRASS, or whatever.
All the best.
-- 
Paolo Cavallini - www.faunalia.eu
Corsi QGIS e PostGIS: http://www.faunalia.eu/training.html
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Andrea Peri
Hi Poalo,

How you can say that the overhead should be minimal.
?
:))

However surely best ifthe python on server is optional in compiling.
So if an user dont want it should remove it.

A.


2014-08-29 11:45 GMT+02:00 Paolo Cavallini :
> Il 29/08/2014 11:41, Andrea Peri ha scritto:
>> I guess the main goal is to avoid that the adopt of python on server
>> could slow it.
>
> Hi Andrea,
> In the first case I imagine (executing Processing modules or models as WPS 
> services),
> the overhead will be minimal, as all the heavy computation is run by the 
> appropriate
> backend.
> All the best.
>
> --
> Paolo Cavallini - www.faunalia.eu
> Corsi QGIS e PostGIS: http://www.faunalia.eu/training.html
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Jürgen E . Fischer
Hi Pirmin,

On Fri, 29. Aug 2014 at 10:24:00 +0200, Pirmin Kalberer wrote:
> This looks like the first real case for an RFC! I'm quite sceptical adding
> Python to QGIS server. In my opinion this should be discussed thoroughly
> first.

I recently spend some time exploring the server side expecially QWC - or other
options.  If I didn't know before, I'd now know why it's called "web".
Frameworks over frameworks in countless languages.Some frameworks are
are quite similar, some are clones or heavily inspired by others, just
implementend in a different languages.   You can't explore them all, but you
can choose without exploring either.  Really frustrating.

News to me was that javascript is apparently also heavily used on the server
side based on node.js.  So more clones and alternatives on the server side to
choose from.

And we have javascript in Qt.  There's even a generator that builds Qt bindings
for javascript.  If that could also be done for QGIS bindings, we could have
plugins in javascript.   And those could work on desktop, server and android.

But that's just an idea that striked me - exploring it would have sidetracked
me even more, so I didn't.   Anyway - maybe good enough to share it.

No links.  I just tried to lookup qt bindings generator I mentioned and found a
qt binding generator for node.js instead - example on the frontpage a message
box - message box on the server side?  No, I'll stop here, no more exploration
for now. ;)


Jürgen

-- 
Jürgen E. Fischer   norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13  Fax. +49-4931-918175-50
Software Engineer   D-26506 Norden http://www.norbit.de


signature.asc
Description: Digital signature
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Alessandro Pasotti
2014-08-29 11:56 GMT+02:00 Marco Hugentobler :
> Hi Alessandro
>
> Thanks for this interesting input. I'm happy to look at it in detail, but
> need a bit of time to review it and think about it thoroughly. Also I'd like
> to do some testing (e.g. run some of my internal server benchmarks here).
>
> As a fery first 2c: Python on the server can open some interesting options
> (expression functions in python, custom renderers, ...). Of course it needs
> the possibility to turn python off for server.
>
> Regards,
> Marco
>

Thank you Marco,

I will be happy to hear about your testing results and I highly
appreciate all advice that you can give me!
I'm sure that there are many improvements that can be made to my
hack-ish proof-of-concept implementation.

A quick question: python plugins only add an #include and two lines of
code in qgis_map_serv.cpp, a #ifdef SERVERPLUGINS block should be
enough to disable them completely, where should I add that option to
let cmake know about it?


-- 
Alessandro Pasotti
w3:   www.itopen.it
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Marco Hugentobler

Hi Alessandro

Thanks for this interesting input. I'm happy to look at it in detail, 
but need a bit of time to review it and think about it thoroughly. Also 
I'd like to do some testing (e.g. run some of my internal server 
benchmarks here).


As a fery first 2c: Python on the server can open some interesting 
options (expression functions in python, custom renderers, ...). Of 
course it needs the possibility to turn python off for server.


Regards,
Marco

On 28.08.2014 14:49, Alessandro Pasotti wrote:

Hello,

as anticipated to some of you during the last HF, I've started to add
Python plugins support for the server side.

The rationale behind server plugins is doublefold: first they could
provide additional services without the need to touch the C++
codebase, second they allow for GUI-based configuration since the
server plugins are not separated from the desktop plugins (of course
the environment and permissions should be carefully configured to
allow information sharing from the desktop user to the webserver user
).

I've already coded a first working implementation and a few
proof-of-concept plugins.

The current implementation is based on the following ideas:

QGIS Python plugins can have additional metatags to specify what
SERVICE and REQUEST they expose, for example:

service=HELLO
methods=GetCapabilities,GetOutput,RemoteConsole

This plugin will respond to calls like
/cgi-bin/qgis_mapserv.fcgi?SERVICE=HELLO&REQUEST=RemoteConsole


The current implementation is pretty simple and CGI-style, whatever
the plugin prints to sdtout is captured and sent back to the client,
the return value from the method is the (optional) content type.

I would like to discuss this ideas during the next HF (or sooner), in
particular:

* I'm not happy with the current request handling and I think we need
a mehod to pass cached parsed project instances to the plugins when
needed and a better handling of HTTP headers
* I 'd like to see signals/slots implementation instead of static
function calls, but maybe it's just syntactic sugar
* from the python side, we don't have an iface to pass to the plugins,
so I'm currently stuck to @staticmethod


The code is in a branch:
https://github.com/elpaso/QGIS/tree/serverplugins

HelloServer demo plugin:
https://github.com/elpaso/qgis-helloserver
It is a test plugin and it provides a remote console (web shell),
insanely insecure DO NOT USE IN PRODUCTION!! and arbitrary python code
execution configurable through the QGIS desktop plugin GUI.

Here is a short demo of the HelloServer plugin:
http://youtu.be/ys9VVxQ8uac

Have fun !!





--
Dr. Marco Hugentobler
Sourcepole -  Linux & Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
marco.hugentob...@sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Alessandro Pasotti
2014-08-29 11:41 GMT+02:00 Andrea Peri :
> I guess the main goal is to avoid that the adopt of python on server
> could slow it.
>
> Infact , the main difference from a desktop and a server is that the
> first is serving only one perosn and this mean that the user could
> wait also for a work for himself.
> Instead a server is used from many users and every of them dont like
> to wait too much.
>
> So the preferrable is if the python server solution sill be optional.
> So who don't need it could to not compile it.


Sure it should be optional, but even when compiled, to avoid the
slowdown it's enough to don't use any plugin, the current
implementation is like a 404 handler: when there is at least one
python plugin installed and there is is no match with the SERVICE
string, then, if a plugin declares that service, it's executed.
This check comes at the end of the loop after all other options have failed.

If the request contains WMS, WCS or WFS then the plugin code is not
even reached, if there aren't any server plugins installed then the
plugin code is never reached.

No slowdown if you don't use the plugins.

Well, just a small slowdown when FCGI app starts the first time but
IMHO is less than noticeable.


Just to make it clear: nobody forces you to use python plugins!

I just like that we now have the possibility to use them, if (and only
if) we want.


-- 
Alessandro Pasotti
w3:   www.itopen.it
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Paolo Cavallini
Il 29/08/2014 11:41, Andrea Peri ha scritto:
> I guess the main goal is to avoid that the adopt of python on server
> could slow it.

Hi Andrea,
In the first case I imagine (executing Processing modules or models as WPS 
services),
the overhead will be minimal, as all the heavy computation is run by the 
appropriate
backend.
All the best.

-- 
Paolo Cavallini - www.faunalia.eu
Corsi QGIS e PostGIS: http://www.faunalia.eu/training.html
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Andrea Peri
I guess the main goal is to avoid that the adopt of python on server
could slow it.

Infact , the main difference from a desktop and a server is that the
first is serving only one perosn and this mean that the user could
wait also for a work for himself.
Instead a server is used from many users and every of them dont like
to wait too much.

So the preferrable is if the python server solution sill be optional.
So who don't need it could to not compile it.

Sincerelly I don t see any advantage in the python server side inside the qgis.

The only scenario I could admit is for a rapid prototype of some
solution, but afer, this
for an usage in a production environment the python solution should be
transform in a C/C++ solution to have the sufficient
execution rapidity.


A.


2014-08-29 10:42 GMT+02:00 Alessandro Pasotti :
> 2014-08-29 10:24 GMT+02:00 Pirmin Kalberer :
>> Hi Alessandro,
>>
>> Am Donnerstag, 28. August 2014, 14.49:47 schrieb Alessandro Pasotti:
>>>
>>> as anticipated to some of you during the last HF, I've started to add
>>> Python plugins support for the server side.
>>>
>>> The rationale behind server plugins is doublefold: first they could
>>> provide additional services without the need to touch the C++
>>> codebase, second they allow for GUI-based configuration since the
>>> server plugins are not separated from the desktop plugins (of course
>>> the environment and permissions should be carefully configured to
>>> allow information sharing from the desktop user to the webserver user
>>> ).
>>
>> This looks like the first real case for an RFC! I'm quite sceptical adding
>> Python to QGIS server. In my opinion this should be discussed thoroughly 
>> first.
>
> Hello Pirmin,
>
> thanks for the feedback!!!  At least this is the start of a discussion
> :) I knew from previous conversations with some of you that adding
> python plugins to the server was not at the top of the priority list
> and
> I added QEP (RFC) in the original subject because I know this topic
> must be discussed: I'm not going to do a PR anytime soon, and my
> implementation is more like an hack to see how far can I go with this
> idea, but, so far, it seems quite promising.
>
> Everybody knows how has been important to have Python plugins on the
> desktop side, coding in Python is 5 to 10 times faster than building
> C++ code and moreover the lower barrier to start being productive will
> bring a lot of new functionalities from a larger pool of developers.
>
> Last but not least, python plugins do not need to pass the
> PR/pull/build/relase cycle that affect the C++ core, which adds a
> considerable delay to bug fixes and new features.
>
> That said, I would really like to hear more from you all about the
> reasons to be against this idea.
>
> --
> Alessandro Pasotti
> w3:   www.itopen.it
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Alessandro Pasotti
2014-08-29 10:24 GMT+02:00 Pirmin Kalberer :
> Hi Alessandro,
>
> Am Donnerstag, 28. August 2014, 14.49:47 schrieb Alessandro Pasotti:
>>
>> as anticipated to some of you during the last HF, I've started to add
>> Python plugins support for the server side.
>>
>> The rationale behind server plugins is doublefold: first they could
>> provide additional services without the need to touch the C++
>> codebase, second they allow for GUI-based configuration since the
>> server plugins are not separated from the desktop plugins (of course
>> the environment and permissions should be carefully configured to
>> allow information sharing from the desktop user to the webserver user
>> ).
>
> This looks like the first real case for an RFC! I'm quite sceptical adding
> Python to QGIS server. In my opinion this should be discussed thoroughly 
> first.

Hello Pirmin,

thanks for the feedback!!!  At least this is the start of a discussion
:) I knew from previous conversations with some of you that adding
python plugins to the server was not at the top of the priority list
and
I added QEP (RFC) in the original subject because I know this topic
must be discussed: I'm not going to do a PR anytime soon, and my
implementation is more like an hack to see how far can I go with this
idea, but, so far, it seems quite promising.

Everybody knows how has been important to have Python plugins on the
desktop side, coding in Python is 5 to 10 times faster than building
C++ code and moreover the lower barrier to start being productive will
bring a lot of new functionalities from a larger pool of developers.

Last but not least, python plugins do not need to pass the
PR/pull/build/relase cycle that affect the C++ core, which adds a
considerable delay to bug fixes and new features.

That said, I would really like to hear more from you all about the
reasons to be against this idea.

-- 
Alessandro Pasotti
w3:   www.itopen.it
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] QEP: QGIS Mapserver Python Plugins

2014-08-29 Thread Pirmin Kalberer
Hi Alessandro,

Am Donnerstag, 28. August 2014, 14.49:47 schrieb Alessandro Pasotti:
> 
> as anticipated to some of you during the last HF, I've started to add
> Python plugins support for the server side.
> 
> The rationale behind server plugins is doublefold: first they could
> provide additional services without the need to touch the C++
> codebase, second they allow for GUI-based configuration since the
> server plugins are not separated from the desktop plugins (of course
> the environment and permissions should be carefully configured to
> allow information sharing from the desktop user to the webserver user
> ).

This looks like the first real case for an RFC! I'm quite sceptical adding 
Python to QGIS server. In my opinion this should be discussed thoroughly first.

Regards
Pirmin

-- 
Pirmin Kalberer
Sourcepole  -  Linux & Open Source Solutions
http://www.sourcepole.com

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer