MAPCSS: Width per latitude

Hello,

I want to make a style where I can add width to a highway and visualise it on top of aerial photos and see them match. This works quite well as long as I don’t change latitude.


At my local latitude, width=9

This becomes a bigger and bigger problem the farther you go north:


Arctic example, width=6

Unexpectedly, however, it has the same effect when I move south. I would expect JOSM to draw a thinner way close to the equator, but it is in fact thicker there too. It only works perfectly at lat 59.* or -59.* :thinking:

At first I wanted to extract lat from JOSM and do make adjustments accordingly, but I’m taken aback by this unexpected behavior.

Besides that, I cant see any features in JOSM/MapCSS that even lets me extract the lat from a road (centroid would be ideal). Nor can I use the viewport position (it seems).

Any ideas?

1 Like

the mapcss is quite simple:

{
	text: width;
	color: #cf0;
	font-weight: bold;
	opacity: 0.1;
	z-index: 1000;
	left-casing-color:black;
	left-casing-width:3;
	left-casing-dashes:0;
	left-casing-opacity:1;
	right-casing-color:black;
	right-casing-width:3;
	right-casing-opacity:1;
	right-casing-dashes:0;
}

way|z16[highway][width]{font-size: 3;}
way|z17[highway][width]{font-size: 5;}
way|z18[highway][width]{font-size: 9;}
way|z19[highway][width]{font-size: 15;}
way|z20[highway][width]{font-size: 25;}
way|z21[highway][width]{font-size: 50;}
way|z22[highway][width]{font-size: 80;}

way|z16[highway][width]{width:eval(tag(width)*1.2);}
way|z17[highway][width]{width:eval(tag(width)*1.8);}
way|z18[highway][width]{width:eval(tag(width)*3.2);}
way|z19[highway][width]{width:eval(tag(width)*6.5);}
way|z20[highway][width]{width:eval(tag(width)*13);}
way|z21[highway][width]{width:eval(tag(width)*27);}
way|z22[highway][width]{width:eval(tag(width)*54);}
way|z23[highway][width]{width:eval(tag(width)*108);}