2

I tried to change the background color of a map in zoomlevels greater than 11, but

Map{ 
  background-color:@water;
  [zoom>11]{background-color:@water*1.05;}
}

had no effect. Is there an other way in CartoCSS to change the background-color for different zoom levels?

  • Think you can only control different colours if it is a layer (point,line,polygon) not the static background. – Mapperz Sep 19 '13 at 2:44
2

I found a workaround: I created a polygon covers the whole world in GeoJSON and added it as layer #backgound.

{
    "type": "Polygon",
    "coordinates": [
        [
            [-180, 89.9],
            [180, 89.9],
            [180, -89.9],
            [-180,-89.9],
            [-180,89.9]
        ]
    ]
}

now i can use this polygon as background

#background {
  polygon-fill:@water;
  [zoom>11]{polygon-fill:@water*1.05;}
}
1

I encountered the same issue and found another solution: global-pattern.

  • Welcome to GIS@SE .. It would help if you described your solution for future readers .. Best Regards – Mark Cupitt Oct 28 '14 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.