Hello,
The pointToPolygonDistance function return positive value for a point in polygon with an hole:
How to reproduce :
Use this file in https://turf-sandbox.netlify.app/
turfSandbox_scipt_pointToPolygonDistance.txt
Fix:
I think that the issue is on line 72 of file https://github.com/Turfjs/turf/blob/master/packages/turf-point-to-polygon-distance/index.ts
return Math.min(smallestInteriorDistance, Math.abs(exteriorDistance));
should be replaced by
return Math.max(smallestInteriorDistance*-1, exteriorDistance);
Hello,
The pointToPolygonDistance function return positive value for a point in polygon with an hole:
How to reproduce :
Use this file in https://turf-sandbox.netlify.app/
turfSandbox_scipt_pointToPolygonDistance.txt
Fix:
I think that the issue is on line 72 of file https://github.com/Turfjs/turf/blob/master/packages/turf-point-to-polygon-distance/index.ts
return Math.min(smallestInteriorDistance, Math.abs(exteriorDistance));should be replaced by
return Math.max(smallestInteriorDistance*-1, exteriorDistance);