[Qgis-user] Multi-line labels and field calculator

Alexander Bruy alexander.bruy at gmail.com
Sun Oct 23 07:44:19 PDT 2011


Hi Andrew,

DBF which is used s attribute storage in shapefiles has several limitations.
Among them — maximum text length is 255 symbols. So if your text
is longer than 255 chars, it will be truncated.

You can load your data into PostGIS or SpatiaLite databases where text
can be much longer that 255 chars. Or alternatively, you can use new
expression based labeling which is available in master.

Hope this helps

2011/10/23 Andrew Chapman <andrew.chapman at donkagen.co.uk>:
> I'm trying to combine multiple attributes into a single multi-line
> equivalent to use as a label in a shapefile.
> I create and populate a new attribute using the field calculator using an
> expression like:
>  stringField + '\n' + '(' + to string(decimalField) + ' some text'
> This successfully creates a multi-line string in the target field PROVIDED
> THAT I DON'T SAVE THE FILE. I can then use the new symbology text to display
> the expected label.
> If I save the layer, the multi-line string is truncated to the first line
> only and the displayed label reverts to the first line.
> The multi-line string therefore isn't saved. Is this a limitation of
> shapefiles or is it a bug?
> If it is a limitation of shapefiles, is there any other way to achieve the
> same effect?

-- 
Alexander Bruy



More information about the Qgis-user mailing list