question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing Map style causes existing layers to disappear

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
z0d14ccommented, May 25, 2017

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…

0reactions
alex3165commented, Sep 26, 2017

Released a fix from @SBRK with version 2.5.2

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found