-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Create new imagery provider for MapBox styles #7698
Conversation
Thanks for the pull request @bampakoa!
Reviewers, don't forget to make sure that:
|
Great, thanks @bampakoa! We'll take a look at this after the release goes out |
@hpinkos this is a draft PR yet. I plan to push some more code along with tests and README changes this week and then I can notify you for reviewing 😉, if that is ok for you. But you can always have a look in the meantime 😃 |
Oh yes! I missed that. Yeah, let me know when its ready =) |
@hpinkos this is ready for review now. You can check it directly in the Hello World app by selecting the Mapbox layers from the picker (I guess I should revert it back l8r to the old Mapbox 😃 ). I have not updated the CHANGES.md file yet since there is not any relevant entry for the next release 😟 @cesium-concierge I have updated the tests 😉 |
Thanks for making this pull request @bampakoa ! ❤️ |
Thanks again for your contribution @bampakoa! No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with |
@OmarShehata can you review? |
Thanks for putting this together @bampakoa ! It seems to work pretty well. I do have some notes/questions:
|
@OmarShehata Hey, to the last point, the old Mapbox API still works, so I wouldn't break it! |
@OmarShehata thanks very much for your feedback 😃
Do you mean to rebase to the master?
You are right, I will update the PR
Sounds good to me. I will update the PR
I think that we shouldn't because as @mrlubos points out the old API has not been deprecated yet. See this comment for more info. |
A rebase isn't necessary, you just need to pull the latest
Thanks for the explanation - I'm still a little bit confused about the difference between these two routes that both get raster tiles from Mapbox:
Is the idea that using the style API (the second one) you have more fine grained control over customizing the look of the map? If so, do you have an example of something you can do with this that you couldn't do before? I'm worried it's still a little big confusing having 2 Mapbox imagery providers that seem like they do the same thing, but just pass different parameters/use a different route? Would it make sense to have one MapboxImageryProvider but have a constructor option to use the style API? |
@OmarShehata Yes, that is right. You can create whatever style you want in Mapbox Studio (such as this one which is GoT based) and then render it inside the client. Here is a brief overview of the differences between them and here is an article that explains why Mapbox is going to deprecate the old map styles
I think that it would be complicated to maintain such a code as the two implementations have different required properties in order to create an object for each ( FYI, I have merged with master but I do not continue to the renaming issue until it will be clear if it makes sense to proceed or not 😃 |
I see what you mean now (that GoT inspired map is awesome!) Thanks for the explanation. I think that's a good reason to have two separate classes if they are different APIs as you describe. I noticed that they never actually use the word "deprecate" in that blog post. It seems like it's still a supported way of getting map tiles. I would say go ahead and name the new provider And then @tfili can you do a final review and merge after that? |
@OmarShehata what about the base layer picker control? Should I leave it as is, to use the initial API of Mapbox? |
Since they're functionally equivalent, I don't think it really matters, but perhaps switching to the newer API is a good idea, so if we did want to add any custom styles to the base layer picker in the future it would be easier to do that. |
Source/Scene/MapboxStyleProvider.js
Outdated
* @constructor | ||
* | ||
* @param {Object} [options] Object with the following properties: | ||
* @param {String} [options.url='https://api.mapbox.com/styles/v1/'] The Mapbox server url. |
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 should be a String
or a Resource
like all our terrain/imagery providers.
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.
@tfili I kept it as String
in order to be the same as the current MapboxImageryProvider
. Shall I change 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.
Yeah, all our providers take Resource
objects now. The MapBox Imagery provider was an oversight.
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.
@tfili I updated the type of the parameter. I think the code already takes resource into account 😉
- Rename from MapboxStyleProvider - Modify CHANGES.md - Add reference to ImageryProvider class
@OmarShehata @tfili this is ready |
Thanks again for your contribution @bampakoa! No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with |
@tfili this one would be nice to get in for release since it's already ready! |
Thanks @bampakoa. Sorry it took so long. Everything seems to work great. |
@tfili @OmarShehata my change has been mistaken added to the 1.58 version release notes in CHANGES.md. Could you please correct it or do you want me to open a PR for this? |
I still don't understand why we need a 2 Mapbox providers in master? Is there a good reason to use one over the other? |
@mramato Mapbox has two different APIs for creating and serving imagery. See #7698 (comment) From what I understand, the newer one allows you to do customize more, but the old workflow isnt deprecated and removing it in Cesiumjs would be a breaking change. |
@OmarShehata Yesss. Do you know if this new imagery will support vector tiles? (as opposed to the raster tiles served by the previous version) |
@OmarShehata I understand that, so is there a reason there wasn't jut an in-place update or are the two incompatible? If the latter, why wasn't the old one deprecated so that we can remove it 3 months from now? Does the old version provide user-accessible functionality that the new one does not? |
@mramato These are questions for Mapbox, not for Cesium. Mapbox released a new API with breaking changes. |
I think the initial confusion here was that the Mapbox static tiles API was deprecated in favor of the styles API. It looks like it is supported and will be supported for the foreseeable future. This is just supporting an additional workflow with different options. For example the raster (old) API lets you specify the image format: https://docs.mapbox.com/api/maps/#raster-tiles. The styles (new) API https://docs.mapbox.com/api/maps/#static-tiles doesn't have this option. I think deprecating and removing it in the CesiumJS side would be removing a feature that's still actively used by the community.
@bampakoa can correct me if I'm wrong here, but it looks like the vector tiles are rasterized on the server, and that's what CesiumJS renders. We do have a feature request to support vector tiles directly in Cesium here: #2132 |
@OmarShehata I understand Mapbox supports vector tiles directly - https://docs.mapbox.com/api/maps/#retrieve-vector-tiles I tried to use this endpoint in Cesium but to no avail. |
Right, it's CesiumJS that doesn't support rendering these vector tiles. |
Is this an issue for a separate pull request @OmarShehata @hpinkos? Anything on the roadmap? |
@OmarShehata you are right. Here is an excerpt from the article https://blog.mapbox.com/use-your-mapbox-studio-styles-everywhere-e29ce5954e47
|
This work intends to incorporate the new Mapbox styles API into Cesium.
Fixes #4015