Skip to content

Commit

Permalink
updated equestImage and the constructor in WebMapTileServiceImageryPr…
Browse files Browse the repository at this point in the history
…ovider.js to address issue #9598
  • Loading branch information
srothst1 committed Jun 9, 2021
1 parent 9b43e2a commit 20d772e
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions Source/Scene/WebMapTileServiceImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,21 @@ function WebMapTileServiceImageryProvider(options) {
var style = options.style;
var tileMatrixSetID = options.tileMatrixSetID;
var url = resource.url;
if (url.indexOf("{") >= 0) {
var templateValues = {
style: style,
Style: style,
TileMatrixSet: tileMatrixSetID,
};

var templateValues = {
style: style,
Style: style,
TileMatrixSet: tileMatrixSetID,
};

//If there is only one "{s}" in the url and there are no other keywords (i.e. "{" only appears once) -> it is safe to use KVP
if (
(url.match(/{s}/g) || []).length == 1 &&
(url.match(/{/g) || []).length == 1
) {
resource.setTemplateValues(templateValues);
this._useKvp = true; //It is safe to use KVP
} else if (url.indexOf("{") >= 0) {
//else continue like we are now
resource.setTemplateValues(templateValues);
this._useKvp = false;
} else {
Expand Down Expand Up @@ -372,6 +380,8 @@ function requestImage(imageryProvider, col, row, level, request, interval) {
queryParameters: query,
request: request,
});
//When useKvp is true, replace the {s} keyword in the requested URL. QUESTIONS: modify `resource`? Should I replace {s} with ""?
resource.url = resource.url.replace("{s}", "");
}

return ImageryProvider.loadImage(imageryProvider, resource);
Expand Down

0 comments on commit 20d772e

Please sign in to comment.