Closed zdila closed 4 years ago
It could be implemented, but I doubt the usefulness of that. For example: on a map twice as detailed, roads appear thicker, but not twice as thick (assuming you meant the inverse calculation X / scale
).
Yes, I meant it inversed.
Usefullness would be added with adding support also for math functions like pow
, exp
, log
. Currently we are generating different styles for each "zoom" - example for valleys seen on www.freemap.sk generated using JsNik.
Hi guys, we are also changing stroke-width and stroke opacity based on scale denominator with different styles (property lines on https://www.viewpoint.ca/map). I'm not sure if we'd change those styles to be dynamic but having scale denominator as a variable could be useful in other areas as well, such as selecting a different file source in PointSymbolizer.
It is possible to calculate scale denominator outside of Mapnik and then pass it to the rendering. I know that @zdila is using node-mapnik. There is a parameter for that (test case). C++ and Python have the same parameters.
@talaj oh, this is a good idea. Thanks!
I think it answers a question for my use-case so let me close it.
Still having it directly as a Mapnik variable along with added math functions and "case when ... then ... else" operator would be AFAIK a good addition.
Mapnik supports those math functions: https://github.com/mapnik/mapnik/blob/cfa5809cd228d11299f2652c7b24004426e1b376/include/mapnik/expression_grammar_x3_def.hpp#L239-L269
Great to hear that. Then currently I am now missing just case
operator to solve #132 in more elegant way.
@talaj not sure if you could help me or recommend somebody who could. I am trying to implement if-then-else operator (cond ? expA : expB
) but I am struggling with it - it doesn't compile. It fails here: https://github.com/zdila/mapnik/commit/52662d0dbcbe90ea80e836574f714b1d8021b0e0#diff-3996f0d1923aa026786a301913ead1e6R122
Also, do you think it is a good approach?
@artemp would know.
Hello,
Is there a reason why
scaleDenominator
is not a variable? We could then use it likestroke-width="[scaleDenominator] / 1000"
.