Oliver Roick

Leaflet.Deflate 2.1 is now available

The latest release introduces the new greedyCollapse option.

A new release of Leaflet.Deflate is now available. Leaflet.Deflate 2.1 introduces a new option, greedyCollapse, to specify when features will collapse.

With greedyCollapse set to true, a feature collapses when either its width or height falls below the specified threshold. This is the default, and it matches the behaviour from previous versions. Set greedyCollapse to false, and features will collapse only of both width and height fall below the specified threshold. This behaviour comes in handy when you have many “long” features on your map.

Animation showing the effect of greedyCollapse in Leaflet.Deflate
The top polygon collapses when one of the sides' length is below the threshold. This is the default behaviour. Without greedyCollapse, the bottom polygon collapses at a lower zoom level when both sides' length are below the threshold. (Background tiles: © Mapbox. Map data: © OpenStreetMap contributors)

My thanks to Simonas Gildutis for contributing the new feature.