[QGIS-Developer] QGIS Server 2.x: issue with @map_scale variable vs. $scale

Neumann, Andreas a.neumann at carto.net
Mon Jul 3 08:46:46 PDT 2017


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? 

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170703/a7c816f0/attachment.html>


More information about the QGIS-Developer mailing list