Skip to content

Polygon validity and performance #100

@zerebubuth

Description

@zerebubuth

Making sure that polygons are valid (which we're not even doing 100% at, see #95 & #87) takes up, on average, about 60% of the time it takes to format an MVT tile. Formatting MVT tiles takes up around 21% of total runtime, and formatting tiles in general takes around 50% of all runtime.

We know that polygon validity is hard, but we need it for V2 #42. We also know that performance could be better #72. Currently, we recurse trying to make the polygon valid #76, which can account for a lot of time for polygons which flip-flop between being valid with fractional coordinates and invalid when we round them to integers.

There are other bits of software we could use to do the polygon validity checking, e.g: prepair or CGAL, or we could do a better job of ensuring polygon validity while rebuilding (while avoiding known issues). A neat method that someone else invented, but I've been unable to find a source for, would be to render the polygon at the integer resolution we want for MVT, then run marching squares to recover a polygon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions