Hi Nyall,

Thanks for explaining this. Makes sense and glad that it will be fixed in QGIS 3.

So my follow-up question is: can I rely on $scale to work in future version of QGIS or will it be deprecated?

Andreas

On 05.07.2017 00:52, Nyall Dawson wrote:
On 4 July 2017 at 01:46, Neumann, Andreas <a.neum...@carto.net> wrote:
Hi,

In a QGIS project that should be published with QGIS Server, I used the
@map_scale variable to define the font size with an expression, depending on
the map scale. It works fine on QGIS Desktop, but on QGIS server GetMap
requests it fails - the font-size (defined in map units) is constant and
doesn't react to my scale dependent rule. The interesting thing, is, that
the same rule works fine in GetPrint requests.

If I change my rule to use $scale instead of @map_scale, my label rule works
fine.

Could it be that the @map_scale variable doesn't work in QGIS server GetMap
requests?
Exactly - it's a consequence of QGIS 2.x server using the really old
map renderer, which means it doesn't have access to any variables
relating to the current map scale/extent/etc. This is also why 2.5d
renderer is quite broken on server under 2.x.

The good news is that it's all fixed with 3.0.

Nyall



Here is my expression:

CASE
    WHEN @map_scale <= 251 THEN 1
    WHEN @map_scale > 251 AND @map_scale <= 501 THEN 2
    WHEN @map_scale > 501 AND @map_scale <= 1001 THEN 3
    WHEN @map_scale > 1001 AND @map_scale <= 2001 THEN 4
    WHEN @map_scale > 2001 AND @map_scale <= 3001 THEN 6
    WHEN @map_scale > 3001 AND @map_scale <= 4001 THEN 7
    WHEN @map_scale > 4001  THEN 8
END

Thanks for your ideas.

Andreas


_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to