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

mapbox-gl-draw when changing mapStyle #494

Closed
vincentsarago opened this issue Sep 2, 2016 · 2 comments
Closed

mapbox-gl-draw when changing mapStyle #494

vincentsarago opened this issue Sep 2, 2016 · 2 comments

Comments

@vincentsarago
Copy link

Hi there,
I know it's not an usual thing, but in a project I have to change the map style (switching between mapbox style or customs raster-tiles).
When calling map.setStyle I'm loosing mapbox-gl-draw to draw on map (events get fired but nothing is drawn on map)
I'm using mapbox-gl v0.21.0 and mapbox-gl-draw v0.11.15

Project url: https://disasterwatch.remotepixel.ca
Project code: https://github.com/RemotePixel/disasterwatch/tree/september

note: when using mapbox-gl v0.230 and mapbox-gl-draw v0.11.15. I'm getting errors in the console when hovering the map after a map.setStyle() [Error] TypeError: undefined is not an object (evaluating 'this._layers[o].source') queryRenderedFeatures (mapbox-gl.js:104:10527) queryRenderedFeatures (mapbox-gl.js:192:5465) exports (mapbox-gl-draw.js:5232) getFeatureAtAndSetCursors (mapbox-gl-draw.js:5246) mousemove (mapbox-gl-draw.js:4463) fire (mapbox-gl.js:218:769) h (mapbox-gl.js:162:1252) u (mapbox-gl.js:162:780)

@samanpwbb
Copy link
Contributor

In similar situations, we've used two different mapbox gl maps synced together. See https://github.com/mapbox/mapbox-gl-sync-move.

This issue is relevant to solving this problem: mapbox/DEPRECATED-mapbox-gl#25.

@vincentsarago
Copy link
Author

I'll close the issue, cause I manage to solve my problem.
I'm not changing the style anymore but applying addSource/addLayer | removeSource/removeLayer instead.

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

2 participants