5

I have points in a layer "Site-Centroids".

I generate a lot of isochrones (polygons) around them, into "Isochrone_Site-Centroids".

With all the isochrones displayed, the map is too busy.

What I want is that no isochrones are initially displayed.

Only when the points from the original "Site-Centroids" are selected, do I want the corresponding isochrones become visible.

The fid's from the "Site-Centroids" are carried over to the isochrones in "ftid", so in the isochrone / polygon layer, I was hoping to use:

is_selected(get_feature('Site-Centroids','fid',ftid))

either as a rule in the rule-based symbology, or as filter on the entire feature. In both cases, nothing is ever displayed.

So, is what I'm trying to do possible (show/hide features in one layer based on selections in another) and, if so, is my approach flawed or just buggy?

3

Assuming that your Isochrone_Site-Centroids layer have a field named "ftid".
Assuming that your Site-Centroids layer have a field named "fid".
(If I am not understanding your use, please comment and I will edit this answer.)

Assuming also, that there are a single feature in Site-Centroids layer for each fid value.


You can control the rendering of the geometries of the Isochrone_Site-Centroids layer, whose ftid attribute matches the fid attribute of the feature selected in the Site-Centroids layer.

Use the Rule-based symbology of the Isochrone_Site-Centroids layer with the following expression:

is_selected( 'Site-Centroids', get_feature( 'Site-Centroids', 'fid', "ftid"))

It is necessary to indicate, to the is_selected() function, the layer on which the selection will be checked. If not, I observed that it assumes an unexpected behavior.

UPDATE (thanks for the observation!):

Also, it is necessary to add a dependency from the isochrone layer to the crentroid layer.

| improve this answer | |
  • Thank you! it was also necessary to add a dependancy from the isochrone layer to the centroid layer. Your edited version using rules is - I think - simpler than the generated geometries aproach, but I learnt a LOT by looking at that strategy. I'd never noticed them before. – dsz Jan 19 '19 at 6:04
  • You are welcome! I thought it was wrong to send an empty string to the geometry generator (I was generating an invalid geometry for features that did not follow the rule), and I decided it was better to change my answer instead of updating it. The same I am seeing that it is not necessary to evaluate the truth condition, allow me to edit my answer once more. By the way, I'm not adding a dependency between the layers, and the expression works well. But I was testing with proof layers (with three and four features each) and have not referential integrity issues. – Gabriel De Luca Jan 19 '19 at 6:24
  • Yes, it's necessary to add the dependency. I had not realized because I had the isochron layer in edit mode. It was nothing related to integrity, I edit the answer once again. – Gabriel De Luca Jan 19 '19 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.