[Qgis-user] Problem with geometry functions ($area, xmax)

Nyall Dawson nyall.dawson at gmail.com
Wed Mar 2 11:06:52 PST 2016


On 3 Mar 2016 12:18 AM, <Fuenfer-Koenigstein.Benjamin at swm.de> wrote:
>
> 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?

Yes - turn off the auto simplification for the layer under the "layer
properties" - "rendering" tab.

Nyall
>
>
>
> Thanks a lot for any help!
>
>
>
> Best regards
>
>
>
> Benjamin Fünfer-Königstein
>
> S-IP-AN-TG Techn. Geschäftsfelder
>
>
>
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160303/b6266b14/attachment.html>


More information about the Qgis-user mailing list