I'd like to style contour lines so that they show differently at varying levels of zoom. When zoomed right out, only the 200m, 400m, 600m, etc. lines should show. When zoomed in a bit further, the 100m, 300m, etc. lines should appear. Text should appear too when zooming in.
I can achieve this fine using reasonably concise OR
syntax in Builder, but when I try to cURL definitions containing OR
conditions to create a named map, the map stops working.
For example, this one works both when cURLed and in Builder:
#layer[value='200'] {
line-width: 0.7;
line-color: #4b3ebc;
line-opacity: 1;
}
But this one containing the OR
condition ,[value='400']
only works in Builder: it does not work when cURLed:
#layer[value='200'],[value='400'] {
line-width: 0.7;
line-color: #4b3ebc;
line-opacity: 1;
}
I can achieve the desired effect by cURLing this more verbose expression of the same thing, but would rather use more concise syntax because the full styling I need involves many more conditions:
#layer[value='200'] {
line-width: 1.5;
line-color: #4b3ebc;
line-opacity: 1;
}
#layer[value='400'] {
line-width: 1.5;
line-color: #4b3ebc;
line-opacity: 1;
}
For reference, here's the full styling I'm trying to achieve, expressed using concise syntax:
#layer[value='200'],[value='400'],[value='600'],[value='800'],[value='1000'],[value='1200'],[value='1400'],[value='1600'],[value='1800'],[value='2000'] {
line-width: 1.5;
line-color: #4b3ebc;
line-opacity: 1;
}
#layer[zoom>10][value='200'],[zoom>10][value='400'],[zoom>10][value='600'],[zoom>10][value='800'],[zoom>10][value='1000'],[zoom>10][value='1200'],[zoom>10][value='1400'],[zoom>10][value='1600'],[zoom>10][value='1800'],[zoom>10][value='2000'] {
text-face-name: 'DejaVu Sans Book';
text-name: [value];
}
#layer[zoom>10][value='200'],[zoom>10][value='400'],[zoom>10][value='600'],[zoom>10][value='800'],[zoom>10][value='1000'],[zoom>10][value='1200'],[zoom>10][value='1400'],[zoom>10][value='1600'],[zoom>10][value='1800'],[zoom>10][value='2000'] {
text-face-name: 'DejaVu Sans Book';
text-name: [value];
}
#layer[zoom>11][value='100'],[zoom>11][value='300'],[zoom>11][value='500'],[zoom>11][value='700'],[zoom>11][value='900'],[zoom>11][value='1100'],[zoom>11][value='1300'],[zoom>11][value='1500'],[zoom>11][value='1700'],[zoom>11][value='1900'],[zoom>11][value='2100'] {
line-width: 1.0;
line-color: #4b3ebc;
line-opacity: 1;
text-face-name: 'DejaVu Sans Book';
text-name: [value];
}
#layer[zoom>12][value='50'],[zoom>12][value='150'],[zoom>12][value='250'],[zoom>12][value='350'],[zoom>12][value='450'],[zoom>12][value='550'],[zoom>12][value='650'],[zoom>12][value='750'],[zoom>12][value='850'],[zoom>12][value='950'],[zoom>12][value='1050'],[zoom>12][value='1150'],[zoom>12][value='1250'],[zoom>12][value='1350'],[zoom>12][value='1450'],[zoom>12][value='1550'],[zoom>12][value='1650'],[zoom>12][value='1750'],[zoom>12][value='1850'],[zoom>12][value='1950'],[zoom>12][value='2050'],[zoom>12][value='2150'] {
line-width: 0.7;
line-color: #4b3ebc;
line-opacity: 1;
text-face-name: 'DejaVu Sans Book';
text-name: [value];
}
I won't post the same CSS expressed the verbose way - if you consider the way those OR
conditions decompose, clearly it's a lot more repetitive.
(I should note that in fact I use Postman, not cURL, but all the docs talk about cURL, so I thought I'd use the same language here.)