Thursday, 25 May 2017

qgis - Label only one polygon in canvas/map view per category/value in attribute table


Question:
In QGIS (2.18), how do you show only one label per field of view in the map canvas for each visible category (that is displayed in the map view/canvas at any given scale/focus) of a multi-feature polygon layer that has been styled with different colours and returns different labels based on fields in its attribute table?


Scenario:
I have a base layer with many polygons and detailed attributes for a QGIS project that I am loading on an Android device using the wonderful QField app.


My problem is that in each map view I have many coloured attributes representing different vegetation types that each show a label for almost every polygon. This clutters up the view considerably.



Result sought:
I only need one label per categorised polygon result (colour etc.) showing per map view, not a label for every polygon visible.


i.e. I need at least one label of every category of vegetation type polygon visible in each map view showing at all times, but I don't want to show two (or more) labels for say "rainforest" if there are 50 small polygons visible.


Or, if there are 5 polygons for "rainforest", 2 polygons for "woodland", and 1 polygon for "lagoon", at all times, I want only one of the polygon's (perhaps either the biggest, average or smallest) for each vegetation type showing.


Tried/doesn't work:
1/ Unfortunately I can not just dissolve the layer by attribute and then show all the visible layers as the shapefile is too big to have to load in its entirety every time.


2/ Can't simply suppress small polygon shape size labels as some very comparatively small polygons require labelling.


Further:
Hoping there is either a built in labelling function button I am missing that help's with this, or a formula I can embed in my current labelling formula to achieve this.


Perhaps there is a QGIS variable equal to "map view" ("canvas extent/view") that may assist?



Or a query to say "show only one label per attribute result visible in map canvas"?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...