[Qgis-user] FW: Simple methodology for user / data / map interactivity?

Bernhard Ströbl bernhard.stroebl at jena.de
Mon Feb 27 01:07:34 PST 2017


Hi Graeme,
as I wrote in my last mail you can set a filter for a layer. This does 
exacly what you describe. Changing the filter according to a changed 
selection in another layer and zooming to the new set sounds like a 
plugin, though.
An non-plugin approach would be to create a view on the db that joins 
zones and roads spatially (e.g. ST_Intersects). If you load this view 
into QGIS you can select the road network layer by attribute zone_id, 
then zoom to the selected road segements. Be aware that QGIS needs a 
unique key for any layer.

Bernhard

Am 24.02.2017 um 15:34 schrieb SEGGIE Graeme:
>
>
> Brent / Bernhard,
>
>
>
> Thanks both for the detailed responses. It does look like I am
> re-inventing a process that can be done as an informed user, I suppose
> the example I suggested might be too simple to be worth going to the
> lengths I described, but I was thinking of some of the manual processes
> I see on editing data and wanted to refine a process to be such that
> repetitive steps could be minimised somehow.
>
>
>
> I see some stuff from both your responses worth me looking into anyway
> even if not pursuing my original approach, which is good.
>
>
>
> I have played some more with this, but am struggling to see how I would
> do the following, which seems like a logical thing to do with QGIS
> acting as a front end to a database.  If I have a zone layer and a road
> network layer, how do I link the two such that the selection in one
> layer impacts the view of the other? For example, if I select a zone, I
> would like that selected zone_id, to be passed to PostGIS, to identify
> the roads which intersect the selected zone and only display them (or
> display them as dominant) as selected in the network layer. Is there a
> way of filtering one layer on the selection of another i.e. filter on
> where zone_id in (selected zone_id in layer X)
>
>
>
> Graeme.
>
>
>
>
>
>
>
> Hi Graeme,
>
>
>
> QGIS can do what you describe in your example out of the box.
>
> Workflow:
>
> 0) copy layer
>
> 1) select polygon in layer
>
> 2) use the spatial query plugin
>
>   - select source from layer_copy
>
>   - Where the feature intersects
>
>   - reference features of layer (tick 1 selected polygon)
>
> - apply
>
> 3) zoom to selection of layer_copy
>
>
>
> If you work with PostGIS you can use the layer's filter to enter any SQL
> thus restricting the features to those that fit into the filter rule.
>
> Then zoom to the layer and you are done.
>
> You can load the result of a query against a PostGIS DB as layer into
> QGIS, too, by using DB manager.
>
> For automation Processing's graphical modeler might be worth looking at.
>
>
>
> Of course you can do most things with a plugin that you e.g. connect to
> a layer action. I am always reluctant to write a plugin for workflows
> that can be performed using QGIS' standard tools, though.
>
> I know users like to klick on a dedicated button and then something is
> run just the way they (think they) need it, however IMHO the smarter
> approach is to train the users to do these tasks themselves with the
> standard tools.
>
>
>
> Bernhard
>
>
>
>>
>
>
>
>
> Sort of in the area you are asking about:
>
>
>
> See the Action tool
>
>
>
> Under Windows this can invoke a batch file to display the result of an
> sql for data about the (Postgis) feature clicked on. Even easier under
> Linux with a bash script. If one of the fields is an image file, you can
> create an action to display the image associates with the feature. A
> useful bit of functionality...
>
>
>
> But to do exactly what you are asking, I think the Attribute table does
> this, so it is a matter of explaining the steps to your users, rather
> than writing code...
>
>
>
> If you select a set of features in a Postgis (or most type of layer)
> layer rendered on the map, QGIS highlights the selected ones as defined
> in the project properties. Open the Attribute table for the layer, you
> will see the selected features, not only highlighted on the map, but
> also in the attribute list. Click the "move selected features to top"
> button, and the selected/highlighted features will always be at the top
> of the list. The attribute table has buttons at the top to zoom & pan to
> selected features...
>
>
>
> Cheers,
>
>
>
> Brent
>
>
>
>
>
> ------------------------------------------------------------------------
>
> *From:*SEGGIE Graeme <gseggie at systra.com <mailto:gseggie at systra.com>>
> *To:* "Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>"
> <Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>>
> *Sent:* Friday, February 24, 2017 6:48 AM
> *Subject:* [Qgis-user] Simple methodology for user / data / map
> interactivity?
>
>
>
> I would like to use QGIS as a visual / interactive front to some PostGIS
> data and am not sure what the best route to doing so is. Happy to
> explore further myself, but wanted to get some input on what needs to be
> joined up to get started on building a little process.
>
>
>
> Basically, if I wanted to present a map of features and have a button
> (like the attribute information one) which a user would click then use
> to select features, I want this to run a SQL query which to get related
> features for example and highlight them on the map view, possibly pan to
> the extent of the newly selected feature set.
>
>
>
> Does this sound like a plugin – or would that be taking things too far?
>
>
>
> Would the best way for the dynamic layer to be setup, to be a view –
> empty except when populated by the query and styled to be dominant over
> the full set of features?
>
>
>
> As a simple example, say I had a district zone system of polygons and I
> wanted a user to be able to click on any polygon, and have all the
> neighbouring polygons highlighted, centred and fill the map view as
> fully as possible. What would be the best / simplest approach to this?
>
>
>
> Graeme
>
>
>
> ========================================================
> This message has been scanned for malware. This message and any
> attachments (the "message") are confidential, intended solely for the
> addressees, and may contain legally privileged information. Any
> unauthorised use or dissemination is prohibited. E-mails are susceptible
> to alteration. Neither our company or any of its subsidiaries or
> affiliates shall be liable for the message if altered, changed or falsified.
> =========================================================
> Ce message a ete verifie et ne contient pas de programme malveillant. Ce
> message et toutes les pieces jointes (ci-apres le "message") sont
> confidentiels et susceptibles de contenir des informations couvertes par
> le secret professionnel. Ce message est etabli a l'intention exclusive
> de ses destinataires. Toute utilisation ou diffusion non autorisee est
> interdite. Tout message electronique est susceptible d'alteration. Notre
> societe et ses filiales declinent toute responsabilite au titre de ce
> message s'il a ete altere, deforme falsifie.
> =========================================================
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
>
> This message has been verified and checked by company's antispam system.
> Click here
> <https://www.mailcontrol.com/sr/POFxmzU97zjGX2PQPOmvUmJg4ssFF0!NdbO3BEwMB!jgWX3YQizdLsE0c3K72bb8HVaKAjchHmeiyla!1rT5xQ==>to
> report this message as a spam.
>
> ======================================================== This message
> has been scanned for malware. This message and any attachments (the
> "message") are confidential, intended solely for the addressees, and may
> contain legally privileged information. Any unauthorised use or
> dissemination is prohibited. E-mails are susceptible to alteration.
> Neither our company or any of its subsidiaries or affiliates shall be
> liable for the message if altered, changed or falsified.
> ========================================================= Ce message a
> ete verifie et ne contient pas de programme malveillant. Ce message et
> toutes les pieces jointes (ci-apres le "message") sont confidentiels et
> susceptibles de contenir des informations couvertes par le secret
> professionnel. Ce message est etabli a l'intention exclusive de ses
> destinataires. Toute utilisation ou diffusion non autorisee est
> interdite. Tout message electronique est susceptible d'alteration. Notre
> societe et ses filiales declinent toute responsabilite au titre de ce
> message s'il a ete altere, deforme falsifie.
> =========================================================
>
> ========================================================
> This message has been scanned for malware. This message and any
> attachments (the "message") are confidential, intended solely for the
> addressees, and may contain legally privileged information. Any
> unauthorised use or dissemination is prohibited. E-mails are susceptible
> to alteration. Neither our company or any of its subsidiaries or
> affiliates shall be liable for the message if altered, changed or falsified.
> =========================================================
> Ce message a ete verifie et ne contient pas de programme malveillant. Ce
> message et toutes les pieces jointes (ci-apres le "message") sont
> confidentiels et susceptibles de contenir des informations couvertes par
> le secret professionnel. Ce message est etabli a l'intention exclusive
> de ses destinataires. Toute utilisation ou diffusion non autorisee est
> interdite. Tout message electronique est susceptible d'alteration. Notre
> societe et ses filiales declinent toute responsabilite au titre de ce
> message s'il a ete altere, deforme falsifie.
> =========================================================
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>



__________ Information from ESET Mail Security, version of virus signature database 15002 (20170227) __________

The message was checked by ESET Mail Security.
http://www.eset.com





More information about the Qgis-user mailing list