I'm working with Leaflet and nodejs and when a polygon layer is loaded when the map view is at world map, the polygon don't shows, I have to zoom in at approximately zoom 10 or 13 to show polygons.

I was trying to use this plug-in but realy don't know how to use it. The lib https://github.com/oliverroick/Leaflet.Deflate

To represent the map I use this

    var layers = {
      type: 'FeatureCollection',
      features: features,
      properties: {}

    showLayers = L.geoJson(layers);

    leafletData.getMap().then(function(map) {


And I try to use it but don't know where?


This is the intended behaviour of Leaflet.Deflate plugin: when a polygon width or height is smaller than the map minSize option (default: 10px) at the current map zoom, it is replaced by a marker.

Make sure you have the marker images so that you can see them as well.

When you zoom in, you increase the polygon size, until it is eventually bigger than the minSize, and the marker is replaced by the polygon itself.

  • Thanks @ghybs for the replay, but how do I use it? in the github page it says that I have to use var map = L.map.deflate('map', {minSize: 20}) but where I put that code? Thanks.
    – Diego
    Dec 28 '15 at 20:18
  • Instead of L.map('map')… but if you have been able to test Leaflet.Deflate already, you should have already used that line of code?
    – ghybs
    Dec 29 '15 at 3:18
  • I've edited my question with the code I use to represent the layers.
    – Diego
    Dec 29 '15 at 12:42
  • Can you kindly detail what leafletData.getMap() does / how it is specified? I am not sure this is standard Leaflet API.
    – ghybs
    Dec 29 '15 at 17:12
  • Yes sory for that, I'm using angular leaflet directive from tombatossals, in this link is an example of usign leafletData.getMap, tombatossals.github.io/angular-leaflet-directive/examples/…
    – Diego
    Dec 29 '15 at 20:44

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.