Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] warn when a geometry exceeds the maximum allowed values #4599

Closed
wants to merge 1 commit into from

Conversation

ansis
Copy link
Contributor

@ansis ansis commented Apr 4, 2016


namespace mbgl {

// the minimum position we can store in the buffers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these constants to the .cpp file, since they're only used there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, done

@mb12
Copy link

mb12 commented Apr 4, 2016

@ansis This does not look right. A valid vector tile should have coordinates within [0, extent). The invariant is even enforced by the mapnik-vector-tile writer (Its a Mapbox project that's called mapnik for probably legacy reasons). Since it uses ClipperLib, in practice it actually generates [0, extent].

@ansis
Copy link
Contributor Author

ansis commented Apr 4, 2016

@ansis This does not look right. A valid vector tile should have coordinates within [0, extent). The invariant is even enforced by the mapnik-vector-tile writer (Its a Mapbox project that's called mapnik for probably legacy reasons). Since it uses ClipperLib, in practice it actually generates [0, extent].

Geometries can (and very often do) extend past the tile boundaries:

A layer MUST contain an extent that describes the width and height of the tile in integer coordinates. The geometries within the Vector Tile MAY extend past the bounds of the tile's area as defined by the extent. Geometries that extend past the tile's area as defined by extent are often used as a buffer for rendering features that overlap multiple adjacent tiles.

https://github.com/mapbox/vector-tile-spec/tree/master/2.1#41-layers

The current implementation in mapbox-gl-native only supports geometries that extend a limited distance from the tile edges. This distance is limited by the precision we have for storing positions in the vertex buffers. This adds a warning for when geometries extend past that limit.

Eventually we may want to clip geometries instead of warning.

@mb12
Copy link

mb12 commented Apr 5, 2016

@ansis Is there any advantage to generating geometries outside the tile boundaries? Is it correct (or not) that everything outside the tile boundary is stenciled out?

@ansis
Copy link
Contributor Author

ansis commented Apr 5, 2016

ansis Is there any advantage to generating geometries outside the tile boundaries? Is it correct (or not) that everything outside the tile boundary is stenciled out?

Yes, there are advantages to having this data in the vector tiles. It is correct that everything outside the tile boundary is stenciled out.

  • the geometries for symbols outside tile boundaries are needed to do cross-tile label placement without collisions. This non-global approach for label placement is needed so that we can render png tiles with cross-tile labels
  • the buffer is also needed to correctly draw lines and circles for png tiles. Sometimes a geometry is entirely within one tile but covers pixels in another tile when styled.

@mb12
Copy link

mb12 commented Apr 5, 2016

Thank you very much @ansis for the detailed explanation.

@jfirebaugh
Copy link
Contributor

This warning turned out to be problematic in gl-js (mapbox/mapbox-gl-js#2568), and ultimately not very useful. Let's not bother.

@jfirebaugh jfirebaugh closed this Sep 21, 2016
@jfirebaugh jfirebaugh deleted the warn-extent-buffer branch September 21, 2016 22:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants