1

For the legend of a trail map I'm working on I'd like to show the trails and their lengths. I have this data in the table. The problem is that not all of the features (lines) have a name or length. Some are ancillary trails that shouldn't be include in the attribute table in the Print Composer.

Are there any suggested techniques for filtering the list or creating some kind of "virtual" vector layer that will filter the data and I can point my Attribute Table to that table?

Sorting by name descending and limiting the number I'm showing is not really an acceptable solution.

enter image description here

  • 1
    I guess if the data I'm displaying isn't actually derived from the features themselves, I could always make another vector layer that just has points, is styled as invisible and just contains the data I want to display. A bit of duplication but it gets the job done, I suppose. – Brian Kelly Apr 4 '14 at 2:03
  • You don't need to duplicate your data on disk (which is begging to get out of sync down the line). Just duplicate your layer in the Layer's list (see my answer below). – MappaGnosis Apr 4 '14 at 7:19
2

You could duplicate your layer in the main window's layer list (right-click your layer and the choose Duplicate). This effectively loads your layer a second time without you needing to make a physical copy on disk and without you needing to convert your lines to points or anything like that (so it is effectively a virtual layer as you require). I would then select my new copied layer and use the Layer->Query to create my sub-selection using a filter expression (this will limit the viewable items in the copied layer, leaving the original one alone). You can also turn your copied layer off so that it doesn't display. Now switch back to you map composer and use the copied layer to create your table.

Afterthought Edit
Of course, if you are not going to include some of your items in the table, perhaps they shouldn't be on the map (and maybe you've used the layer style to hide the unwanted ones) - in which case use the same technique via Layer->Query to limit the items to just those you want rather than hide some via the symbology and that way you don't need to duplicate the layer and can use a simpler approach to creating the style. I don't know if this is what you did but I can imagine it being done by some readers who are not aware of the option to sub-select their layer.

  • Some of the items are trails without names (small connection trails) that should be shown on the map but don't have relevant data. – Brian Kelly Apr 5 '14 at 0:06
3

This is a really good feature idea - thanks for the inspiration. I've just added this ability to QGIS. So if you run a current snapshot, or when 2.4 is released, there's an easy way to set a filter for an attribute table:

enter image description here

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.