booleanPointInPolygon type/documentation quibble
The documentation refers to the point argument as of type Coord with description "input point". The example shows the use of turf.point() to convert a coordinate to a Point geometry.
In fact, it seems that both a bare coordinate, or a Point geometry are acceptable.
So:
- the type should probably be
Coord | Point - the example should probably not contain the superfluous type conversion
Also, this documentation is unclear:
True if polygon boundary should be ignored when determining if the point is inside the polygon otherwise false.
If I understand what it means, this would be (imho) be clearer:
If true, a point lying on the polygon boundary is not considered to be "within" the polygon.
Hi @stevage. Sorry only just getting to this now.
the type should probably be Coord | Point
I actually find the Coord (turf-helpers defined convenience type) more confusing than helpful. My preference would be to list that argument as Position (bare bones number array) | Point (simple geojson geometry) | Feature<Point> (full blown geojson feature). That reflects what is actually defined on the function (as the aforementioned Coords alias).
the example should probably not contain the superfluous type conversion
You're right it's not the absolute minimal example, though I think it reads better to the casual user. The var pt is a Point, rather than the var pt is a number array.
Also, this documentation is unclear
Agreed. How does the below look overall:
* Determines if a point lies within a polygon. The polygon can be convex or
* concave, or contain holes.
*
* @function
* @param {Position|Point|Feature<Point>} point Point possibly within the polygon.
* @param {Feature<Polygon|MultiPolygon>} polygon Polygon to search within.
* @param {Object} [options={}] Optional parameters.
* @param {boolean} [options.ignoreBoundary=false] If set to true, a point lying on the polygon boundary is not considered to be within the polygon.
* @returns {boolean} True if the point lies within the polygon, false otherwise.
Agree with all that.
Point possibly within the polygon.
This wording is a little clumsy, perhaps "Point being tested."
- @param {Feature<Polygon|MultiPolygon>} polygon Polygon to search within.
Probably the same should apply:
* @param {Polygon|MultiPolygon|Feature<Polygon|MultiPolygon>} polygon Polygon to search within.