Wednesday, 1 July 2015

labeling - How map unit affects the caption size in the label in Qgis?


I tried to make a the label caption size adjusted relatively to the map scale. It worked, more or less, when I set the size into map unit. I set them to 0.1, and when I zoom out the caption size get smaller enter image description here And when I zoom in it get bigger enter image description here


However I cannot understand what is the "map point" logic, or in other words how does it work. And one more question: is there a better way to adjusted the caption size and force them to always be inside the polygon?



Answer



The points unit represents a constant size for the label on the screen, more or less the same as millimeters or pixels. Regardless of the map scale, a label of 10 points will be 10 points tall (let's ignore font sizing subtleties). It is your responsibility to hide the labels - or use a different size - beyond given map scales. For instance, labeling continents, you probably will keep the same size all the time, though if you label streets you will not want a size 10 label at any scale.


The map unit is the opposite. A label of size 1 (degree, meters, you name it) will always be of size 1 on the map, so the closer you are to scale 1:1 the bigger it is on your screen, and the more you zoom out the smaller the label is, still on your screen.


If you want finer control of a label that gets smaller as you zoom out and bigger as you zoom in, you would have to select the points unit, so the reference size is always the same on the screen, but you would also dynamically set the size in function of the scale, something like 10000000 /@map_scale (of course it depends on your data and you may want a non-linear scaling).


Label by map scale



To answer you second question, you can instruct QGIS to hide labels that are not fully contained in their feature


Label inside feature


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...