Changing Map style causes existing layers to disappear
See original GitHub issueI’m trying to allow someone to toggle between street view and a satellite view. I have several <GeoJSONLayer>
's mounted and working fine but when I change the <Map>
style, those layers appear to disappear.
An error is thrown at line 114 of geojson-layer.ts saying Uncaught TypeError: Cannot read property 'setData' of undefined
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Make data layer disappear and different one appear on ...
You need to store the current zoom level when zoomed to a state using stateZoomLevel = map.getBoundsZoom(e.target.getBounds()); .
Read more >P: Layer "disappearing" when dragged at certain zoom levels
When I'm trying to drag or re-scale any smart object or a type, styling, appeareance or effects or the entire layer disappears.
Read more >Persistent layers after style change in Mapbox gl js
Is it possible to change map style from Streetview to satellite retaining all manually drawn layers (geojson shapes)?.
Read more >Layers | Style Specification | Mapbox GL JS
A style's layers property lists all the layers available in that style. The type of layer is specified by the "type" property, and...
Read more >Why do some features disappear at high zoom levels?
If you have very dense data, sometimes you may notice that some of the features "disappear" from your map at high zoom levels...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
nope, we have an existing bug in our app related to this issue, have fixed several times in our implementation over this lib but it keeps popping up; i dont mind doing the workaround (making sure all layers are removed, changing style, then adding them back), but it kinda sucks that it keeps popping up – i think getting some guarantees and tests around how the map style changing behaves would be 👍 and if i can possibly find some time I’ll try and work on it…
Released a fix from @SBRK with version
2.5.2