Adjusting Polygon Visibility with CartoCSS

by Samantha Bamberger   Last Updated November 30, 2017 23:22 PM

I am attempting to adjust the visibility of a polygon layer in Carto by zoom level. To keep it simple for now I am looking to have the opacity of 1 from zoom 0-7 and opacity 0 from zoom 8+. I am working directly in Carto (not tilemill, or elsewhere) and have tried a few methods. Most notably, this method (found on this question) only worked for point data, not polygons.

Getting the zooms to adjust for point data worked using the following, now I'm just trying to adapt it for use with polygons.

    #layer {
    marker-allow-overlap: true;
    [zoom = 0]{opacity:1}
    [zoom = 8]{opacity:0}
    }

Right now I've gotten myself stuck at

    #layer {
    [zoom = 0]{opacity:1}
    [zoom = 8]{opacity:0}
    }


Related Questions





how cartodb.createLayer function works

Updated September 19, 2017 06:22 AM

Carto - Search for point by name and zoom to

Updated October 03, 2016 08:09 AM