leaflet-polyline-hausdorffdistance

0.2.0 • Public • Published

Leaflet Hausdorff Distance

This plugins enables you to compute distance between two L.PolyLine objects using the Hausdorff distance.

Installing

Put the L.Polyline.HausdorffDistance script after the Leaflet one:

<script src="leaflet.js"></script>
<script src="L.Polyline.HausdorffDistance.min.js"></script>

Usage

This plugins adds two methods to L.Polyline objects:

  • distanceTo(other: L.Polyline, resampling?: number): computes the distance
  • furthestFrom(other: L.Polyline, resampling?: number): returns the two furthest points

Given two L.Polyline objects a and b, get the distance between a and b simply by calling a.distanceTo(b).

For better results, the methods resample the polylines down to at least one point every 10 meters. You can turn it off by passing null as resampling parameter.

Package Sidebar

Install

npm i leaflet-polyline-hausdorffdistance

Weekly Downloads

7

Version

0.2.0

License

MIT

Unpacked Size

54.3 kB

Total Files

10

Last publish

Collaborators

  • tmuguet