Skip to content

tmuguet/Leaflet.Polyline.HausdorffDistance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Extends L.Polyline to compute distances between two polylines

Resources

License

Stars

Watchers

Forks

Packages

No packages published