I’m trying to create a UrlTemplateImageryProvider, but the image URL naming requires a format of:
/1/0001/0001_0001.png
which I was able to create with this template:
var TILE_LOAD_URI_TEMPLATE = ‘/{z}/000{reverseY}/000{reverseY}_000{x}.png’;
The problem of course is that this breaks when e.g. {reverseY} is greater than 9. The generated URL (fragment) is e.g.:
‘/1/00011/00011_0002.png’;
but it needs to be:
‘/1/0011/0011_0002.png’;
(Notice one fewer zero in front of each ‘11’.)
I had a quick look at the source and can’t find a way to do this. Am I missing something?
Hi Dave,
I don’t think the UrlTemplateImageryProvider can currently do this. It replaces the bracketed values with the number, so it doesn’t have a way of knowing how many zeros you need in front of the number.
I don’t think it would be too difficult to change the code to do this though. You should be able to change these functions to return a string with the appropriate number of zeros:
) {
return undefined;
}
var formatIndex = 0;
var that = this;
function handleResponse(format, data) {
return format.callback(data);
}
function doRequest() {
if (formatIndex >= that._getFeatureInfoFormats.length) {
// No valid formats, so no features picked.
return when([]);
}
var format = that._getFeatureInfoFormats[formatIndex];
var resource = buildPickFeaturesResource(
This file has been truncated. show original
Just for reference, take a look at our build guide if you need help checkout out the code or building it: https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Documentation/Contributors/BuildGuide
Best,
Hannah
Thanks Hannah,
I’ll look at adding this to the code and issue a pull request when I’m done.