Comments (5)
@Algunenano sorry for the late responses here as I have been on holiday. I am going to dig into this right now
from wagyu.
Alright, I do not think this is a bug -- this has to do with the way that snap rounding occurs and the danger of using wagyu with very small differences between your integers. The snap rounding within Wagyu attempts to snap any possible crossing of a line within a 0.5x0.5 square of any point being processed. After iterating through it snaps down this entire shape into a single line, which is then discarded during processing.
Here is a screenshot of the original shape:
Here is a screenshot of the result after the vatti step (before it is then passed to correct_topology
)
from wagyu.
I do not like that the algorithm does this, but it is one of the few ways that it can fix really nasty issues with data. The solution might be to consider how we could scale up and then down the values here based on a parameter before entering and exiting the algorithm. Something like "snap_rounding_precision", where if you set it to a value of 0.5 for example, it would scale all values up and then back down before performing the entire operation.
However, in this case the results would then need to be in a floating point format as a result, because you could have points at 0.5 etc.
from wagyu.
@Algunenano sorry for the late responses here as I have been on holiday. I am going to dig into this right now
No worries; happy new year!
Alright, I do not think this is a bug -- this has to do with the way that snap rounding occurs and the danger of using wagyu with very small differences between your integers. The snap rounding within Wagyu attempts to snap any possible crossing of a line within a 0.5x0.5 square of any point being processed. After iterating through it snaps down this entire shape into a single line, which is then discarded during processing.
Are you sure that that snapping is the issue? If I scale the polygon (I've tried both x2 and x10) I get nothing out of the Vatti execution, and if I translate the polygon (x += 10000, y stays the same) I also don't get anything out of that step.
However, in this case the results would then need to be in a floating point format as a result, because you could have points at 0.5 etc.
I guess that even if this worked I'd need to be able to do the scale down before validation, as rounding to int values might produce invalid polygons again.
from wagyu.
Are you sure that that snapping is the issue? If I scale the polygon (I've tried both x2 and x10) I get nothing out of the Vatti execution, and if I translate the polygon (x += 10000, y stays the same) I also don't get anything out of that step.
There was an error in these tests, this indeed works but it has other effects (see above).
So I've tried 2 things to workaround this small polygons disappearing:
- Reduce the snap margin (or remove it completely).
- Scale the geometry up and then down, which for MVT meant gridding it again to integer values after wagyu was done (to make sure no
.5
were left behind).
In both cases I end up seeing more small parts that before were removed (like the ones in the issue I opened) but I also see self-intersections and spikes; for example:
Before:
Obviously it'd be great to have the cake and eat it, but I don't see an easy way to keep the small polygons and the validity. Taking into account that dropping small polygons in MVT isn't that bad (it's just that we are dropping some extra ;D), I'll stick with having the cake and maintain validity.
Closing this for now, maybe I'll revisit it in the future.
from wagyu.
Related Issues (20)
- intersection return empty HOT 2
- Is it okay to call wagyu::execute() multiple times? HOT 1
- Feature Request: make wagyu container neutral HOT 1
- Support 64bit integer properly HOT 1
- DoMaxima error HOT 4
- Wagyu creates spike geometry
- Python port & binding HOT 2
- G++ -Wconversion warnings HOT 1
- Add support for double and float
- Compatibility with g++ 4.8 (older libstdc++) HOT 2
- Possible null pointer dereference in add_ring_to_local_minima_list() HOT 2
- Test for 3098baa HOT 2
- Investigate if bounding box check makes quick_clip faster
- Wagyu should only compile with integer type coordinates
- Fixture tester should not access invalid array entries
- Recent large code coverage changes HOT 2
- Interruption mechanism HOT 1
- Return early if original polygons don't require fixing
- Mapbox Issue with snapping of LineString to the actual road HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wagyu.