We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, i found the following test for PolyUtil::distanceToLine function in googlemaps/android-maps-utils library:
PolyUtil::distanceToLine
LatLng startLine = new LatLng(28.05359, -82.41632); LatLng endLine = new LatLng(28.05310, -82.41634); LatLng p = new LatLng(28.05342, -82.41594); double distance = PolyUtil.distanceToLine(p, startLine, endLine); assertEquals(37.947946, distance, 1e-6);
But for this data PolyUtil::isLocationOnEdge function returns incorrect value 42.989894449231 Code for test:
PolyUtil::isLocationOnEdge
<?php require_once("./MathUtil.php"); require_once("./SphericalUtil.php"); require_once("./PolyUtil.php"); $point = ['lat' => 28.05342, 'lng' => -82.41594]; $start = ['lat' => 28.05359, 'lng' => -82.41632]; $end = ['lat' => 28.05310, 'lng' => -82.41634]; $response = \GeometryLibrary\PolyUtil::distanceToLine($point, $start, $end); var_dump($response);
I think this is due to difference in source code between you're library and googlemaps/android-maps-utils library:
+$sa = array('lat' => $p['lat'] - $start['lat'], 'lng' => $p['lng'] - $start['lng']); +$sb = array('lat' => ($u * ($end['lat'] - $start['lat'])), 'lng' => ($u * ($end['lng'] - $start['lng']))); +return SphericalUtil::computeDistanceBetween($sa, $sb); -LatLng su = new LatLng(start.latitude + u * (end.latitude - start.latitude), start.longitude + u * (end.longitude - start.longitude)); -return computeDistanceBetween(p, su);
I will create PR to fix this issue
The text was updated successfully, but these errors were encountered:
df85bd4
Merge pull request #12 from gistrec/fix-polyutil-distancetoline
102958a
Fix PolyUtil distanceToLine function. Close #11
No branches or pull requests
Hi, i found the following test for
PolyUtil::distanceToLine
function in googlemaps/android-maps-utils library:But for this data
PolyUtil::isLocationOnEdge
function returns incorrect value 42.989894449231Code for test:
I think this is due to difference in source code between you're library and googlemaps/android-maps-utils library:
I will create PR to fix this issue
The text was updated successfully, but these errors were encountered: