Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Satellite view removed existing layer(line or geojson) from street view #8646

Closed
Piruthivirajan opened this issue Aug 16, 2019 · 4 comments
Closed

Comments

@Piruthivirajan
Copy link

Piruthivirajan commented Aug 16, 2019

Satellite view removed an existing layer(line or geojson) from street view v-9

mapbox-gl-js version:

browser:

Steps to Trigger Behavior

1.street view
2.draw line layer
3.change to Satellite

Link to Demonstration

https://jsbin.com/

Expected Behavior in Satellite

expected

Actual Behavior

@Piruthivirajan Piruthivirajan changed the title Satellite view removed existing layer(line) from street view Satellite view removed existing layer(line or geojson) from street view Aug 16, 2019
@ryanhamley
Copy link
Contributor

Layers and sources are per style. When you change the style, the new style does not know about the old style's sources and layers so they won't automatically reappear on the map. You'll need to add the line layer to the satellite style when you switch to it.

@Piruthivirajan
Copy link
Author

Thanks for your response. Is there any shortcut to get already drew layers(Line or geojson), Then apply to satellite style?

@ryanhamley
Copy link
Contributor

Not really. This is something you'll have to implement yourself however best works in your application. It's common to keep track of what layers have been added/are visible and then loop over them and add them again when the style changes.

@andrewharvey
Copy link
Collaborator

#4006 has some proposals and workarounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants