Errors with isLocationOnPath
Xring-git opened this issue · comments
Xring commented
Hi,
if I calculate distance from a point and a segment:
$response = $polyUtil->distanceToLine(
['lat' => 46.111691, 'lng' => 13.003583], // point array [lat, lng]
['lat' => 46.112111, 'lng' => 13.003857], // line startpoint array [lat, lng]
['lat' => 46.112113, 'lng' => 13.003888] // line endpoint array [lat, lng]
);
I'll obtain 51.256 meters (it'is about the correct distance in real world).
But if i calculate intesection:
$response = $polyUtil->isLocationOnPath(
['lat' => 46.111691, 'lng' => 13.003583], // point array [lat, lng]
[ // poligon arrays of [lat, lng]
['lat' => 46.112111, 'lng' => 13.003857],
['lat' => 46.112113, 'lng' => 13.003888]
],
10 // 10 meters of tollerance
);
I'll obtain true
with only 10 meters of tollerance.
I've other examples of wrong intersections.
Alexander Pechkarev commented
Hi @Xring-git,
Thank you for raising the issue.
This library has been ported from Google Maps Android API., please fill free to propose a solution.
Regards,
Alexander