1

I've setup a node mapnik server to render some tiles for polygons. The application I've built to call out to these tiles is in Leaflet

An example of a current mapnik styling rule is below

<Style name="pubLands">
        <Rule>
          <Filter>[simple] = 'blm'</Filter>
          <PolygonSymbolizer fill="#e3cc00"/>
          <LineSymbolizer stroke="black" stroke-width=".1"/>
          <TextSymbolizer size="5" fill="black" face-name="Helvetica Black Regular" halo-fill="#DFDBE3" halo-radius="1" wrap-width="20">[detail]</TextSymbolizer>          
       </Rule>
</Style>

Features within this rule are being styled at all zoom levels etc. I would like to only show labels at my map's zoom levels of 13+. How can I modify the style.xml to only label above a certain zoom level, in this case a Leaflet zoom of 13+?

1 Answer 1

2

Scale dependent rules need to be applied via min/max scale denominators. https://github.com/mapnik/mapnik/wiki/MinScaleDenominator

Converting mapnik scales to map scales requires a conversion. The table below is a good start http://wiki.openstreetmap.org/wiki/MinScaleDenominator

My example ended up working with something like below

<Rule>
      <Filter>[simple] = 'state'</Filter>
      <MaxScaleDenominator>170000</MaxScaleDenominator>
      <MinScaleDenominator>0</MinScaleDenominator>
      <TextSymbolizer size="5" fill="black" face-name="Helvetica Black Regular" halo-fill="#DFDBE3" halo-radius="1" wrap-width="20">[detail]</TextSymbolizer>
</Rule>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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