Comments (3)
Hi @azureshin,
Have run your example, following will work, please note tolerance is given in meters, in this case 130m will return true.
The location ['lat' => 25.771, 'lng' => -80.186] is considered on path with tolerance 130 meters, return true.
tolerance = 140 - return true
tolerance = 130 - return true
tolerance = 120 - return false
tolerance = 100 - return false
and so on
$r = \GeometryLibrary\PolyUtil::isLocationOnPath(
['lat' => 25.771, 'lng' => -80.186], // point array [lat, lng]
[ // poligon arrays of [lat, lng]
['lat' => 25.774, 'lng' => -80.190],
['lat' => 18.466, 'lng' => -66.118],
['lat' => 32.321, 'lng' => -64.757]
],
130);
from geometry-library.
Hi @azureshin,
Please can you try to reduce $tolerance from 0.001 to 0.1 ?
According to Floating point precision "numbers have limited precision and non elementary arithmetic operations may give larger errors, and, of course, error propagation must be considered when several operations are compounded."
Looking deeper in the code:
// $toleranceEarth = 0.001;
$tolerance = $toleranceEarth / MathUtil::EARTH_RADIUS; // 6371009
// tolerance at this stage 1.5696100884491E-10
// than following is called
$havTolerance = MathUtil::hav($tolerance);
//$havTolerance = 6.159189574403E-21
from geometry-library.
Dear @alexpechkarev
I try to $tolerance from 0.001 to 0.1
but it return false
thanks....
from geometry-library.
Related Issues (12)
- Uninitialized string offset HOT 4
- Update HOT 1
- Issue with PolyUtil::distanceToLine function
- PHP 7.4 Depreciated Syntax HOT 1
- tolerance in meters or degrees HOT 1
- Errors with isLocationOnPath HOT 1
- Intersection of two direction given start points and bearings HOT 1
- Call the function isLocationOnEdge with parameter $ geodesic = false HOT 1
- How do I include into a php file? HOT 1
- Perpendicular of a line in PHP HOT 1
- Call to undefined method GeometryLibrary\\PolyUtil::distanceToLine() HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geometry-library.