Giter VIP home page Giter VIP logo

Comments (5)

flippmoke avatar flippmoke commented on September 17, 2024

@Algunenano sorry for the late responses here as I have been on holiday. I am going to dig into this right now

from wagyu.

flippmoke avatar flippmoke commented on September 17, 2024

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:

screen shot 2019-01-02 at 3 37 41 pm

Here is a screenshot of the result after the vatti step (before it is then passed to correct_topology)

screen shot 2019-01-02 at 3 41 22 pm

from wagyu.

flippmoke avatar flippmoke commented on September 17, 2024

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 avatar Algunenano commented on September 17, 2024

@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.

Algunenano avatar Algunenano commented on September 17, 2024

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:
image

After:
image

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.