Skip to content
New issue

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

Errors with isLocationOnPath #15

Closed
Xring-git opened this issue Jul 7, 2020 · 1 comment
Closed

Errors with isLocationOnPath #15

Xring-git opened this issue Jul 7, 2020 · 1 comment

Comments

@Xring-git
Copy link

Xring-git commented Jul 7, 2020

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.

@alexpechkarev
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants