Skip to content

[FR] Keep track of geometry parts when tiled #710

@AbelVM

Description

@AbelVM

Why

As of today, using MVT, when a geometry overlays several tiles, it gets split into pieces, one per tile. Client-side, the visual effect is nowhere to be found as

It does that by rendering the polygon larger than the tile size and then clipping it, 
so it's not really merging but more of drawing side by side.

But, if any feature extends across several tiles:

  • Labels: there would be a label per feature portion
Image
  • queryRenderedFeatures and querySourceFeatures both return not features, but features' parts, so you need to postprocess the results to get the right features count
Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, 
feature geometries may be split or duplicated across tile boundaries and, as a result, features may 
appear multiple times in query results. For example, suppose there is a highway running through 
the bounding rectangle of a query. The results of the query will be those parts of the highway that 
lie within the map tiles covering the bounding rectangle, even if the highway extends into other tiles, 
and the portion of the highway within each map tile will be returned as a separate feature. Similarly, 
a point feature near a tile boundary may appear in multiple tiles due to tile buffering.
  • Export: there is no way to retrieve the data in the viewport for a given layer, as the features' geometries make no sense without further processing

Proposal

  • Store a geometry ID per feature's geometry, to take into account multigeometry features, just the ordinal of the geometry in the original feature
  • Store a vertex ID per geometry's vertex, just the ordinal of the vertex in the original geometry
    • outer rings and lines: vertex_id >0
    • inner rings: vertex_id < 0. TBD, but it would be like -1000000 * hole_ordinal - vertex_ordinal (so we can take into account several holes)
    • "synthetic" vertices generated at feature-tile intersection: vertex_id = 0 (so they can be discarded later)

This way, the original geometries can be rebuilt later (at current LoD, indeed)

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