Leaflet draw does not show the area of the Polygon

214 views Asked by At

I've seen that in some examples using leaflet draw, after drawing the third point, a popup shows the area of the drawn item on the map. I'm unable to replicate this function even setting the

polygon: {
          showArea: true,
        },

Here's my code (angular 13)

    var drawnItems = new L.FeatureGroup();
    this.map.addLayer(drawnItems);

    var drawControl = new L.Control.Draw({
      draw: {
        polygon: {
          showArea: true,
        },
        marker: false
    },
    edit: {
        featureGroup: drawnItems,
    }
});


  this.map.addControl(drawControl);
  this.map.on('draw:created', function (e) {
    const type = (e as L.DrawEvents.Created).layerType,
    layer = (e as L.DrawEvents.Created).layer;

    drawnItems.addLayer(layer);

});

Could you suggest how to do it?

0

There are 0 answers