-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add dynamic raster tiles support #12352
Conversation
6ef2c83
to
c6200fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I usually delete layers, then delete sources, switch the url, then re-add everything. This seems like a convenient method, and nothing jumps out as being out of place. The test looks good. Can you confirm you've given it a basic test to ensure it looks visually correct?
src/source/raster_tile_source.js
Outdated
this.load(() => this.map.style._clearSource(this.id)); | ||
} | ||
|
||
setSourceProperty(callback: Function) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing comment, no action needed: Interesting. This is a bit of a strange method. The only usage I see is:
mapbox-gl-js/test/unit/source/vector_tile_source.test.js
Lines 405 to 407 in 3b88dc4
source.setSourceProperty(() => { | |
source.attribution = 'OpenStreetMap'; | |
}); |
So I think it's equivalent to:
source.attribution = 'OpenStreetMap';
source.reload()
Maybe it's just a placeholder in case the reload logic gets more complicated. Just jumped out as a bit odd since by the arguments, the method doesn't itself set anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rreusser 👋
Thanks for the review! Previously I used setSourceProperty
in the VectorTileSource's setTiles
and setUrl
methods, so it's more like a leftover. I've removed it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! At the very least, maybe wrapSourceMutation(() => {...})
would convey the intent more clearly, but removing works as well. 👍
0900747
to
f011270
Compare
This PR adds methods for changing a raster tile source dynamically (e.g.
setTiles
,setUrl
). Same as in vector tiles #8048.Closes #11982
Launch Checklist
mapbox-gl-js
changelog:<changelog>add methods for changing a raster tile source dynamically (e.g. setTiles, setUrl).</changelog>