[Qgis-developer] Change the query of a query layer (postgis)
enricofer
enricofer at gmail.com
Wed Jun 17 07:03:35 PDT 2015
Hi Olivier,
In your case, I think that the best way to do this is to create a view from
the sql query and load it as layer, than, when qslider changes, change the
view definition with "ALTER VIEW" and reload the layer.
Regards,
Enrico Ferreguti
Il giorno 17/giu/2015, alle ore 14:29, olivier [via OSGeo.org] <
ml-node+s1560n5211424h13 at n6.nabble.com> ha scritto:
Hi !
Is it possible to change the query of a postgis query layer in python
without reloading the project ?
The goal is to have a parameter in my query that I'd be able to change with
a slider.
I tried the QgsVectorLayer.setDataSource() method, but it makes QGis crash.
I tried the workaround described here (
http://gis.stackexchange.com/questions/62610/changing-data-source-of-layer-in-qgis
), writing and reading the XML file, but it also makes QGis crash.
If not possible, is there a serious limitation behind this, or is the
feature just missing/bugged ?
Example :
I have this query loaded as a layer:
"SELECT id, name, ST_Buffer(geom,25) as geom FROM my_table"
But I want to be able to change the hardcoded buffer from 25 to some value
from a QSlider.
Thanks!
Olivier
_______________________________________________
Qgis-developer mailing list
[hidden email] </user/SendEmail.jtp?type=node&node=5211424&i=0>
http://lists.osgeo.org/mailman/listinfo/qgis-developer
------------------------------
If you reply to this email, your message will be added to the discussion
below:
http://osgeo-org.1560.x6.nabble.com/Change-the-query-of-a-query-layer-postgis-tp5211424.html
To unsubscribe from Quantum GIS - Developer, click here
<http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4099106&code=ZW5yaWNvZmVyQGdtYWlsLmNvbXw0MDk5MTA2fDcwMTIyMjE0OA==>
.
NAML
<http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Change-the-query-of-a-query-layer-postgis-tp5211424p5211452.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150617/adb46f0e/attachment.html>
More information about the Qgis-developer
mailing list