-
Notifications
You must be signed in to change notification settings - Fork 466
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
Splitter function can not be used when the length of the line segment is short #1073
Comments
The issue is in the tolerance that is too low: var splitter = new ol.interaction.Splitter({ source: vector.getSource(), tolerance: 0.001 }); |
Hi bro.I copy the code of the example, change the view projection from 'default' to 'EPSG:4326', and the splitter didn't work again. // The map
var map = new ol.Map({
target: "map",
view: new ol.View({
center: [121.2738842396899, 30.179885990299272],
// center: ol.proj.transform(
// [121.2738842396899, 30.179885990299272],
// "EPSG:4326",
// "EPSG:3857"
// ),
zoom: 20,
projection: "EPSG:4326",
}),
layers: layers,
});
...
// Add splitter before other interaction
var splitter = new ol.interaction.Splitter({
source: vector.getSource(),
tolerance: 0.001,
}); |
The tolerance must be set in the coord system. |
The issue is due to numeric instability on calculation. |
Thanks.I tried adjusting tolerance and alignTolerance many times, but this function still doesn't work properly in the coordinates I set (sometimes it splits a line into multiple segments with shorter intervals). In this case, is there any good way to quickly help me complete the setting and adjustment of these two parameters so that this function can work properly? |
To prevent digital instability you can round coordinates, here is an example that round coords to 1E10: https://codepen.io/viglino/pen/QWRmapz?editors=0010 |
The text was updated successfully, but these errors were encountered: