Skip to content

Commit

Permalink
Handle mapproxy cache provider
Browse files Browse the repository at this point in the history
  • Loading branch information
volterra79 committed Mar 1, 2024
1 parent ebb57cd commit bcf2c1d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/app/core/layers/imagelayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function __(name, value) {
* @param config.bbox
* @param config.capabilities
* @param config.cache_url
* @param config.cache_provider @since 3.10.0
* @param config.baselayer
* @param config.geometrytype
* @param config.editops
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/layers/map/xyzlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ proto.isVisible = function(){

proto._makeOlLayer = function(){
this._olLayer = new RasterLayers.XYZLayer({
url: `${this.layer.getCacheUrl()}/{z}/{x}/{y}.png`,
url: `${this.layer.getCacheUrl()}`,
maxZoom: 20,
extent: this.config.extent,
iframe_internal: this.iframe_internal,
Expand Down
9 changes: 8 additions & 1 deletion src/app/core/layers/mixins/geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,14 @@ proto.isCached = function() {
};

proto.getCacheUrl = function() {
if (this.isCached()) return this.config.cache_url;
if (this.isCached()) {
/** @since 3.10.0 **/
if (this.config.cache_provider && 'mapproxy' === this.config.cache_provider) {
//in the case of mapproxy provider, cache_url contains {z}/{x}/{-y}.png set
return this.config.cache_url;
}
return `${this.config.cache_url}/{z}/{x}/{y}.png`;
}
};

// return if layer has inverted axis
Expand Down

0 comments on commit bcf2c1d

Please sign in to comment.