Leaflet.Path.Transform icon indicating copy to clipboard operation
Leaflet.Path.Transform copied to clipboard

Invalid LatLng object: (NaN, NaN) on a Polyline

Open rodriguesrl opened this issue 4 years ago • 1 comments

Hello, I'm having an issue enabling the transform of a specific polyline, it only happens on that angle and i have no idea what might be causing this.

const test0 = [[-37.726626484318366, 140.4386936336438], [-37.72662681154198, 140.43865956345152]];
let line = L.polyline(test0, { color: 'black', transform: true }).addTo(this.map);
line.transform.enable({
      rotation: true,
      scaling: false,
    });

This is the stacktrace of the error: image

Let me know if you need any further info.

rodriguesrl avatar May 14 '20 01:05 rodriguesrl

Hello, I think I'm having a similar issue. It occurs when my bounding box is very narrow

line = [[43.33590744464275, -0.3963140790767437], [43.33593313218462, -0.3956736383198142], [43.335944134296874, -0.39494411645328126]]

When looking at the code, I think there is a division by 0 in L.PathTransform.pointOnLine function

nbioret avatar Jun 04 '20 14:06 nbioret