alexpechkarev/geometry-library

Call to undefined method GeometryLibrary\\PolyUtil::distanceToLine()

contreras2004 opened this issue · 3 comments

I cant find the function inside the PolyUtil Class. Did you remove it?

Used composer to install this library. Awesome work by the way.

Thanks @contreras2004 !

The distanceToLine() method is still there.
Try with backslash (\) as per below:

/**
* no backslash -> GeometryLibrary\PolyUtil::distanceToLine 
* with backslash - > \GeometryLibrary\PolyUtil::distanceToLine
*/

$response =  \GeometryLibrary\PolyUtil::distanceToLine(
              ['lat' => 61.387002, 'lng' => 23.890636], // point array [lat, lng]
              ['lat' => 61.487002, 'lng' => 23.790636], // line startpoint array [lat, lng]
              ['lat' => 60.48047, 'lng' => 22.052754] // line endpoint array [lat, lng]
             );  
             
  echo $response; // 12325.124046196 in meters

Nop, its not there. Please try to install the library with composer. I had to download the library using the zip File and add it manually to the PolyUtil class

Thanks for checking!
I have updated the release version to 1.0.1 that should now include distanceToLine() method.
Regards