mjaschen / phpgeo

Simple Yet Powerful Geo Library for PHP
https://phpgeo.marcusjaschen.de
MIT License
1.56k stars 195 forks source link

Division by zero in BearingEllipsoidal.php on line 206 #79

Closed andriyandriyan closed 3 years ago

andriyandriyan commented 3 years ago

Hello, I've been getting an ErrorException in line 206 of the BearingEllipsoidal.php file.

mjaschen commented 3 years ago

Hi,

thanks for reporting this. Can you provide details on how to trigger this error? i.e., for which input values the exception in thrown?

andriyandriyan commented 3 years ago

This is my code


$polyline = new Polyline();
foreach ($path as $value) {
    $polyline->addPoint(new Coordinate($value["lat"], $value["lng"]));
}
$processor = new SimplifyBearing(90);

$simplified = $processor->simplify($polyline);
mjaschen commented 3 years ago

Can you provide the polyline's latitude/longitude values? (e.g. via email: mjaschen@gmail.com)

andriyandriyan commented 3 years ago

This is my lat/lng values https://gist.github.com/andriyandriyan/475859e51632a1259a7e57e0aced402f

mjaschen commented 3 years ago

Fixed in versions 3.2.1 and 2.6.1.

Thanks again for reporting.