-
Couldn't load subscription status.
- Fork 3.7k
Add Azure 2D imagery provider #13001
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
base: main
Are you sure you want to change the base?
Conversation
|
Thank you for the pull request, @lukemckinstry! ✅ We can confirm we have a CLA on file for you. |
|
ready for review @ggetz |
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.
Thanks @lukemckinstry! I did an initial pass on the code and have a few questions and comments.
I will follow up to test this shortly.
| providerViewModels.push( | ||
| new ProviderViewModel({ | ||
| name: "Azure Maps Labels Only", | ||
| iconUrl: buildModuleUrl( | ||
| "Widgets/Images/ImageryProviders/azureLabels.png", | ||
| ), | ||
| tooltip: | ||
| "Place labels from Azure Maps to combine with other imagery such as Sentinel-2", | ||
| category: "Cesium ion", | ||
| creationFunction: function () { | ||
| return IonImageryProvider.fromAssetId(3891170); | ||
| }, | ||
| }), |
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.
Does a labels-only layer make sense for the base layer provider? I'm leaning towards no since labels-only is typically applied on top of another dataset as opposed to being used as the base layer.
| style: Cesium.IonWorldImageryStyle.AERIAL_WITH_LABELS, | ||
| }), | ||
| baseLayer: Cesium.ImageryLayer.fromProviderAsync( | ||
| Cesium.IonImageryProvider.fromAssetId(3830183), |
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.
What was the motivation for changing this away from Bing?
| this._subscriptionKey = | ||
| options.subscriptionKey ?? options["subscription-key"]; | ||
| //>>includeStart('debug', pragmas.debug); | ||
| Check.defined("options.tilesetId", options.tilesetId); |
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.
I ran into this in https://github.com/CesiumGS/cesium/pull/13004/files#diff-8c9bd0da5a2315f5b1211e299d0d1517027f1bf8e7a3eab29a601b6761f548f1R46, but it looks like there is a discrepancy between the docs for Azure2DImageryProvider.ConstructorOptions which specifies a default and the implemented behavior.
In my PR, I implemented the default value. Please let me know if that assumption was wrong.
| this._tileCredits = resource.credits; | ||
| this._attributionsByLevel = undefined; | ||
| // Asynchronously request and populate _attributionsByLevel | ||
| this.getViewportCredits(); |
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.
The promise kicked off by this function could reject unpredictably, and that can lead to confusing behavior in isolation, like when called in a unit test.
Ideally, we should not kick off any async processes in the constructor. See how I handled this in https://github.com/CesiumGS/cesium/pull/13004/files#diff-7142af57f22c9916aeeac920512bb9d8211e4a6b769201230de03902b119fa1bR487-R501 and let me know if you have any feedback.
| const viewport = await Resource.fetch({ | ||
| url: url, | ||
| queryParameters: { | ||
| tilesetId, | ||
| "subscription-key": key, | ||
| "api-version": "2024-04-01", | ||
| zoom: level, | ||
| bounds: "-180,-90,180,90", | ||
| }, | ||
| data: JSON.stringify(Frozen.EMPTY_OBJECT), | ||
| }); | ||
| const viewportJson = JSON.parse(viewport); |
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.
Here and for Google2DImageryProvider—
- We can use
Resource.fetchJsonto return JSON directly - This should likely use a derived resource so that if the provider was created with an
IonResource, we use the derivedIonResourcewith the correct headers and refresh behvaior.
| level, | ||
| ), | ||
| ); | ||
| } |
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.
Not strictly required to merge this PR, but I wonder if we can more lazily request tile credits as needed based on the current zoom level, and potentially extents, alongside the image requests in requestImage.
This would also potentially apply to Google2DImageryProvider.
Description
Switches on the Azure2DImageryProvider class. Also adds viewport attribution logic for Azure layers.
To Do
DO NOT MERGE until complete
Issue number and link
Testing plan
NOTE: Test using ion staging asset IDs until prod assets are ready
Sandcastles (to publish in prod)
To view the sandcastles, add the key to your Ion Staging account.
Test both ways to add Azure 2D data
Author checklist
CONTRIBUTORS.mdCHANGES.mdwith a short summary of my change