-
Notifications
You must be signed in to change notification settings - Fork 919
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
boolean-within returning false positives at horseshoe polygons #2059
Labels
Comments
Same the following, returns true but it shouldn't: turf.booleanWithin(
{
type: "Feature",
properties: {},
geometry: {
type: "LineString",
coordinates: [ [9.15, 32.46], [12.33, 41.6] ],
},
},
{
type: "Feature",
properties: {},
geometry: {
type: "Polygon",
coordinates: [
[ [-0.64, 23.73], [0.89, 24.06], [0.91, 24.34], [1.65, 24.58], [2.22, 24.89], [2.48, 25.14], [2.9, 25.78], [2.78, 25.86], [3.95, 28.17], [4.16, 28.05], [5.36, 30.12], [5.38, 30.25], [5.48, 30.34], [5.49, 30.49], [5.57, 30.55], [5.57, 30.66], [5.67, 30.77], [5.69, 30.9], [5.8, 31.04], [5.81, 31.11], [5.75, 31.23], [5.77, 31.3], [5.55, 31.44], [5.6, 31.54], [5.83, 31.43], [5.89, 31.53], [5.71, 31.7], [5.77, 31.79], [5.81, 31.77], [5.82, 31.79], [5.92, 31.72], [5.9, 31.7], [6, 31.66], [6.04, 31.7], [6.25, 31.59], [6.27, 31.57], [6.36, 31.23], [7.13, 31.6], [9.08, 32.05], [9.03, 32.42], [9.15, 32.46], [9.26, 32.45], [9.33, 32.18], [9.51, 32.21], [9.58, 31.88], [10.05, 31.93], [10.12, 31.7], [10.96, 31.97], [10.79, 32.39], [13.87, 33.69], [13.97, 33.68], [13.99, 33.55], [13.87, 33.5], [13.86, 33.47], [13.92, 33.33], [13.92, 33.29], [13.98, 33.25], [14, 33.19], [14.09, 33.2], [14.26, 33.26], [14.13, 33.54], [14.15, 33.58], [14.09, 33.63], [14.23, 33.63], [14.47, 33.77], [14.6, 33.79], [14.65, 33.88], [14.78, 33.93], [14.9, 33.93], [14.99, 33.97], [15.07, 33.57], [15.27, 33.6], [15.25, 33.87], [15.27, 33.87], [15.31, 33.55], [15.45, 33.55], [15.44, 33.72], [15.35, 33.8], [15.34, 33.84], [15.36, 33.86], [15.46, 33.76], [15.75, 33.72], [15.97, 33.73], [16.24, 33.66], [16.19, 33.24], [16.28, 33.21], [16.32, 33.2], [16.44, 33.32], [16.68, 33.24], [16.9, 33.27], [17.1, 33.19], [17.19, 33.3], [17.93, 33.36], [18.27, 33.25], [17.91, 32.5], [18.45, 32.33], [18.62, 32.87], [18.67, 32.86], [18.83, 32.7], [18.83, 32.65], [19.31, 32.51], [21.4, 32.27], [23.41, 32.26], [23.27, 33.59], [23.79, 34.31], [23.99, 34.46], [24.24, 34.54], [24.75, 34.52], [25.93, 34.61], [26.03, 34.67], [26.14, 34.68], [26.31, 34.38], [26.4, 34.42], [26.29, 34.63], [26.35, 34.65], [26.37, 34.63], [26.36, 34.58], [26.49, 34.38], [26.57, 34.32], [26.7, 34.32], [26.66, 34.66], [26.69, 34.72], [27.12, 34.89], [27.36, 35.2], [28.19, 37.15], [28.46, 37.95], [28.43, 38.03], [28.56, 38.13], [28.58, 38.07], [28.66, 37.99], [28.74, 38.06], [28.7, 38.11], [28.74, 38.18], [28.67, 38.28], [29.11, 38.62], [29.08, 38.65], [29.34, 38.86], [30.31, 39.88], [30.51, 40.01], [30.54, 40.08], [30.83, 40.15], [30.84, 40.11], [30.89, 40.13], [30.88, 40.16], [31.15, 40.25], [31.72, 40.38], [31.79, 40.07], [31.89, 40], [32.05, 40.05], [32.36, 40.08], [32.32, 40.16], [32.48, 40.22], [32.47, 40.26], [32.54, 40.29], [32.58, 40.17], [32.64, 40.15], [33.17, 40.25], [33.46, 40.4], [33.37, 40.75], [33.56, 40.79], [33.65, 40.46], [33.8, 40.11], [33.9, 40.16], [33.81, 40.48], [33.77, 40.8], [33.81, 40.81], [33.68, 41.6], [21.08, 41.6], [20.37, 41.21], [17.49, 41.15], [13.6, 41.36], [9.29, 39.94], [6.59, 39.49], [2.53, 38.38], [-0.3, 36.01], [-0.64, 35.35], [-0.64, 23.73] ],
],
},
}
); Using turf@7.0.0-alpha.114 |
4 tasks
turf-boolean-within wasn't testing if the last point of the LineString was within Polygon. I've created a fix in PR #2599 |
Fixed in @turf/turf@7.0.0-alpha.115 |
Closing, please feel free to reopen @RobertOrthofer if this doesn't fix your particular use case. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please provide the following when reporting an issue:
@turf/boolean-within 6.3.0
.geojson
).https://gist.github.com/RobertOrthofer/cf45710fabdcbde73d2b5e39b4deebd9
Code to reproduce in RunKit:
https://runkit.com/embed/7bxlrywqnurr
boolean-within
falsely returnstrue
for horseshoe polygons intersecting a simple line features. By that i mean Polygons shaped like a U, intersecting, but not fully containing a LineString. At first i thought i misinterpreted the docs, but adding just an additional segment to the LineString outside the Polygon makesbooleanWithin
returnfalse
, which seems correct to me.This is probably related to #2049 and #1897
The text was updated successfully, but these errors were encountered: