cesium
cesium copied to clipboard
Can the options in WebMapServiceImageryProvider support customTags field?
Feature
Can the options in WebMapServiceImageryProvider support customTags field?
I have an idea: on WebMapServiceImageryProvider source may be able to add some UrlTemplateImageryProvider options?
I commit a PR for this issue, I really need this change to facilitate my implementation of a feature,Many thanks.
Hi @itancc! Thanks for the interest!
There is a parameters
option which lets you append additional query parameters. Is that sufficient for your use? If not, could you please explain your use case a bit further?
Oh, the parameters
may not be suitable. For example, I need to modify the BBox parameters because I will be performing a coordinate transformation, so supporting customtags
would be convenient for me to rewrite the bbox
Here is some pseudo-code:
const imageryProvider = new WebMapServiceImageryProvider({
parameters: {
bbox: "{customBBox}",
},
// @ts-ignore
customTags: {
customBBox: (
imageryProvider: ImageryProvider,
x: number,
y: number,
level: number
) => {
const rect = imageryProvider.tilingScheme.tileXYToRectangle(x, y, level);
// here I can do some custom logic, like transforming the bounding box
const customRect = transformBboxFunction(rect);
return `${customRect.west},${customRect.south},${customRect.east},${customRect.north}`
},
},
});
For example, I need to modify the BBox parameters because I will be performing a coordinate transformation,
Thanks @itancc. This may be a bit of an edge case in my opinion. Given that you're re-writing one of the existing parameters, it may be better for you to use UrlTemplateImageryProvider
directly.
I hope to make the most of some optimizations available in the existing WmsMapServiceImageryProvider, such as cache, which I find excellent! If I switch to using UrlTemplateImageryProvider, I might need to rewrite a whole set of code similar to WmsMapServiceImageryProvider. So, it would be convenient if such an option could be provided. Also, this shouldn't be disruptive, right?