-
Notifications
You must be signed in to change notification settings - Fork 941
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
Unable to find segment #244139 [-71.66191017921575, 19.182076213197277] -> [-71.65740874033601, 19.204588002723632] in SweepLine tree #2258
Comments
@mkorpela indeed a bug. However it looks like the issue is related to the decimals of your coordinates: const u = turf.union(turf.truncate(p1), turf.truncate(p2))
console.log(JSON.stringify(u))
// {"type":"Feature","properties":{},"geometry":{"type":"MultiPolygon","coordinates":[[[[-73.062444,18.596802],[-73.054078,18.559575],[-73.024499,18.427748],[-73.008564,18.508849],[-72.992607,18.590015],[-73.062444,18.596802]]],[[[-73.048498,19.747137],[-73.017618,19.691036],[-73.03139,19.750748],[-73.048498,19.747137]]],[[[-72.653649,20.124248],[-72.653196,20.122267],[-72.64762,20.123415],[-72.653649,20.124248]]],[[[-72.551084,17.974866],[-72.457103,17.972276],[-72.463205,17.999399],[-72.507543,18.195904],[-72.516579,18.150057],[-72.543707,18.01234],[-72.551084,17.974866]]],[[[-71.826784,20.010058],[-71.807452,19.913124],[-71.789212,20.004869],[-71.826784,20.010058]]],[[[-71.66191,19.182076],[-71.656205,19.153361],[-71.657409,19.204588],[-71.66191,19.182076]]]]}} |
Thanks for the tip about the truncate! This bug case from internals of a fairly complex algorithmic manipulation. |
I believe I'm hitting the same issue, I hope this information is helpful: Version: 6.5.0 const turf = require('@turf/turf')
const feature1 = require('./feature1')
const feature2 = require('./feature2')
turf.difference(feature1, feature2) Output:
|
@btisdall have you tried truncating the features? turf.difference(
turf.truncate(feature1),
turf.truncate(feature2)
) |
I'm hitting the same issue when doing Note: I've already run them through Edit: |
I'm also facing this issue but with
|
We ran into the same issue. Although turf.truncate allows the processing to work without encountering the SweepLine error, this solution has a pretty drastic performance problem. We use union/difference to maintain our hierarchy shapes based on changes to lower shapes in the hierarchy. Making a change that used to take <3 seconds would take about 8 seconds using this approach. It is especially bad when dealing with shapes like Alaska where there are a large number of islands making up the state. Definitely not an acceptable performance hit. I'm not sure of the feasibility of changing the find segment logic to have a slight tolerance to account for the decimals issue when searching. Just a thought. |
Union boom crash with comment "Unable to find segment #244139 [-71.66191017921575, 19.182076213197277] -> [-71.65740874033601, 19.204588002723632] in SweepLine tree. Please submit a bug report."
.geojson
).... naah
The text was updated successfully, but these errors were encountered: