0

I use the following code to draw a GPS track with Leaflet:

const trackJson: L.GeoJSON = L.geoJSON(trackAsJson, {
      style: {
        color: '#ff0000',
        weight: 30,
        opacity: 1
      }
    });

I'd like now calculate the area that is covered by this track, drawn with the specified weight/width. However, I can't find any way to achieve that. All methods that I could find require to have some form of a shape and not just only a line. So I'm either looking for a way to:

  1. Turn the path and the specified weight into a shape or
  2. Find a direct method to calculate the area of a path and a weight.
IvanSanchez
  • 18,272
  • 3
  • 30
  • 45
Fischer Ludrian
  • 629
  • 1
  • 9
  • 23

1 Answers1

0

If you just need an approximation, you could render the track / path and count the pixels.

How to calculate the area of a java.awt.geom.Area?

Reto Höhener
  • 5,419
  • 4
  • 39
  • 79