[Qgis-user] Problem with geometry functions ($area, xmax)
Fuenfer-Koenigstein.Benjamin at swm.de
Fuenfer-Koenigstein.Benjamin at swm.de
Wed Mar 2 05:18:20 PST 2016
Dear List Members,
I have a problem with labeling polygon-features using expressions. I want to create different label-classes depending on the area of the geometries (cities, villages, etc.). In most cases, this works quite well but in some cases I get weird effects as some labels disappear on certain scale-levels or get placed on parts of the geometries that don't really make sense.
Looking for a reason for that behavior, I found out that geometry-functions deliver very different values depending on the current scale level. For getting some examples, I labeled one feature with the following expression:
'xmax: ' + to_string(format_number(x_max($geometry), 0)) +' m; ' + 'area: '+ to_string(format_number(to_real($area),0)) + ' m2'
results:
On scale 1:50,000: 'xmax: 4,479,481 m; area: 232,526,142 m2'
On scale 1:100,000: 'xmax: 4,479,481 m; area: 5,343,813 m2'
On scale 1:800,000: 'xmax: 4,479,431 m; area: 4,885,325 m2'
I can send screenshots if needed.
With 'identify features' tool, I get an area of 232,528,728 square meters, which suggests that $area at scale 1:50,000 is almost correct.
General info: I'm working with QGIS 2.14, geometries come from a PostGIS-server, geometries and project use CRS DHDN / Gauss-Kruger zone 4 (EPSG:31468), the features I want to label are multipart polygons (I get the same effects using non-multipart features).
Does anyone have an idea if I may have missed some settings that cause the mentioned effects? Or may it be a bug in the geometry functions?
Thanks a lot for any help!
Best regards
Benjamin Fünfer-Königstein
S-IP-AN-TG Techn. Geschäftsfelder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160302/963681df/attachment.html>
More information about the Qgis-user
mailing list