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

Map snapshotter sometimes fails to render style that defines default camera #16454

Open 1ec5 opened 4 years ago

1ec5 commented 4 years ago

If a map snapshotter does not define a camera but rather relies on the stylesheet’s center and zoom properties to set a default camera, the snapshot fails to draw anything much of the time, even if a background layer is applied using runtime styling. The on-again, off-again nature of this issue suggests a race condition.

This issue has been causing a frequent test failure on CI, mapbox/mapbox-gl-native-ios#291, which we’re working around in mapbox/mapbox-gl-native-ios#293 by hard-coding the default camera at runtime.

There don’t appear to be any unit tests of styles that set a default camera, so that would be a good place to start.

/cc @mapbox/gl-native

1ec5 commented 4 years ago

Note that mapbox/mapbox-gl-native-ios#291 only affected -[MGLMapSnapshotterTests testRuntimeStyling], not -[MGLMapSnapshotterTests testLocalGlyphRendering]. One of the differences between the two tests is that the style for -testRuntimeStyling was specifying Null Island at z0 as the default camera, whereas the style for -testLocalGlyphRendering specifies a default camera over 39.09187°N, 14.41400°W (a bit north of the Azores) at z0.