mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.36k stars 1.33k forks source link

Render result depends on `buffer` setting when using `distance` or `within` expression #16464

Open zmiao opened 4 years ago

zmiao commented 4 years ago

For styles that use geojson source, due to the geojson buffer, the evaluation result will be different for features that span multiple tiles. When using distance or within expressions, which will evaluate based on the feature's geometry data. However, with different geoson buffer settings, the feature will be clipped with different geometry data, which will lead to rendering differences.

Take following example to illustrate, the original line string passed as geojson is one LineString feature, when zoom in and zoom out, since the line string spans multiple tile, it will be clipped into several new LineString features. The line string which is within the polygon will be shown as red , otherwise blue.

Buffer 0 Zoom 2 vs Buffer 128 Zoom 2:

Screen Shot 2020-05-11 at 6 59 36 PM

Buffer 0 Zoom 3 vs Buffer 128 Zoom 3:

Screen Shot 2020-05-11 at 7 02 15 PM

Buffer 0 Zoom 4 vs Buffer 128 Zoom 4:

Screen Shot 2020-05-11 at 6 59 54 PM

cc: @chloekraw @alexshalamov