Mapnik is very smart about converting map scale to zoom level. As a secret/power user feature, Mapnik exposes a !scale_denominator!
variable that changes according to the zoom level and + latitude of the vector tile being rendered. Read about the Mapnik's !scale_denominator!
variable here.
With some postgres magic, the !scale_denominator
lets us control which features appear and disappear, within a layer.
Concretely this is a two-part process. First you will need to load the following z()
function into your PostGIS database:
CREATE OR REPLACE FUNCTION public.z(scaledenominator numeric)