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.37k stars 1.33k forks source link

Layers are not shown offline in some cases #15631

Closed MiltonCordoba closed 4 years ago

MiltonCordoba commented 5 years ago

I have a question, I am working with offline maps and there are cases in which the previously saved layer is not shown.

I have compared a case where it works and another where it does not work, and in both cases, the "OfflineRegion" is exactly the same. The JSON files of the map style are also the same. Any suggestions about this? Thank you!

LukasPaczos commented 5 years ago

Hey @MiltonCordoba, could you provide more information about the used region and what do you mean by the "previously saved layer"? A self-contained reproducible example would be great as well. Thanks!

valllllll2000 commented 5 years ago

I seem to be faced the same issue. Will write the self contained example this morning. But to sum up, I am drawing geoshapes on the map, based on your example: https://github.com/mapbox/mapbox-android-demo/blob/master/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/dds/SatelliteLandSelectActivity.java but I also download an offline area before I open the map. Your example uses 3 layers but I have in total 6 of them. Unfortunately when offline, only the layer showing areas is displayed, the lines and points are not. Update: so when opening the map the first time all layers seems to show. The issue is when the geojson sources get updated once the map is loaded.

valllllll2000 commented 5 years ago

@LukasPaczos I have provided an example: https://github.com/akvo/offline-shape-draw-bug the instructions on how to use it are on the README.

Basically the issue is: SymbolLayer (text label) https://github.com/akvo/offline-shape-draw-bug/blob/master/app/src/main/java/org/akvo/flow/offlineexample/SatelliteLandSelectActivity.kt#L196 and CircleLayer https://github.com/akvo/offline-shape-draw-bug/blob/master/app/src/main/java/org/akvo/flow/offlineexample/SatelliteLandSelectActivity.kt#L183 share the same geojson source. The SymbolLayer seems to not work when offline and since it uses the same geojson source as CircleLayer it also "breaks" the circleLayer. If I make the CircleLayer use a different source from SymbolLayer, then the CircleLayer works fine, it's just the SymbolLayer that does not work. When online, everything shows correctly. After opening that map online, and going offline again everything works. It seems that the SymbolLayer needs something to be downloaded and just cannot work offline. @MiltonCordoba the issue seems similar to yours but if it's not I may create another one.

stale[bot] commented 4 years ago

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.