4

When I join a layer with another layer all the attributes are correctly displayed in the first layer.

However when I use the Query builder (Layer - Query) and then use Zoom to layer, nothing is displayed.

I have added a vector layer with attribute values from Excel and joined it with another layer consisting of polygons. The polygon layer then displays all the attributes in its table from the Excel imported layer. When I want to view only selected polygons using the Layer > Query using the joined attribute values and use Zoom to Extent nothing happens.

Rule-based styling seems to be the answer.

0
3

As far as I know Query Builder is not supported yet for layers with joins, at least not on QGIS 1.8 on MacOS.

Query Builder button in Layer Properties > General window is disabled and Query item in right click menu on layer is not shown.

All you can do is use rule-based styling for showing/hiding elements on the layer with joins (Layer Properties > Style).

If you want to perform dynamic selections and zooming you can use the Advanced search in the attribute table view (right click on layer > Open Attribute Table; in the right bottom part of the window you'll find Advanced search button). This will permit you to select features using SQL on all layer's fields, and you'll be able to zoom to selected features.

Anyway, I agree with you: query builder on joined layers would be a useful improvement!

2

If you do the Query Builder BEFORE you do the join, it will still work.

The version that I am using is 2.8.1, however, so I don't know if this would work in older versions.

As PieterB said, you can use the "Save As..." on the joined layer then do the query on that new data. For my situation, that original shp will change often but the joined data will not. This would create several shapefiles that are not needed.

1
1

Save your joined shapefile as a new shapefile: Layer > Save as.
You wil see in the attributetable that the excelcolumns are 'incorporated' in the new shapefile. Now you can do the query as well.

0

I have the same issue with QGIS 3.16. I tried to use the rule solution, but it doesn't work for me, still, after the Query building noting is visible, the query itself works, because the test results are fine. I'm adding *.shp fail and I want to build a query to see just part of the data which have the same value for one of the attributes.

0

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.