Conversation
c79d4d8 to
a18bdc8
Compare
…e site of the globe In order to prevent a WMS layer from appearing twice, once in CH and once close to New Zealand, pretty much the same fix as for WMTS was applied. See: c689f9a
a18bdc8 to
05583ea
Compare
| if (this.gutter !== -1) { | ||
| source = new TileWMS({ | ||
| projection: this.projection, | ||
| url: this.url, | ||
| gutter: this.gutter, | ||
| tileGrid: tileGridLV95, | ||
| }) | ||
| } else { | ||
| source = new ImageWMS({ | ||
| projection: this.projection, | ||
| url: this.url, | ||
| tileGrid: tileGridLV95, | ||
| }) | ||
| } |
There was a problem hiding this comment.
This looks really the same as line 57 to 68, would it be possible to use some setter for the TileGrid instead of recreating the same instances with this new option?
There was a problem hiding this comment.
Good point. I tried this with the most recent commit and it seems to work.
Did not try this in the first place because of the comment in OpenLayersWMTS
| // tile grid and reprojection to WebMercator is done in analogy to WMTS to prevent | ||
| // that the layer appears twice, once in CH and once near New Zealand. | ||
| // see: https://github.com/geoadmin/web-mapviewer/commit/c689f9a650c546c6e52a91fc2086d7cbbf48faa2 | ||
| if (this.gutter !== -1) { |
There was a problem hiding this comment.
I am also not 100% sure if it is correct to do the reprojection only for the TileLayer and not in case of ImageLayer.
But for ImageLayer this did not seem to be possible and probably not necessary, if I correctly understood this.
There was a problem hiding this comment.
I think you are right on this, I checked OpenLayer's API documentation and ImageWMS class doesn't have a function called setTileGridForProjection. So if you do not filter for the gutter options you might end up with an error in the console (and no layer shown on the map...)
| // tile grid and reprojection to WebMercator is done in analogy to WMTS to prevent | ||
| // that the layer appears twice, once in CH and once near New Zealand. | ||
| // see: https://github.com/geoadmin/web-mapviewer/commit/c689f9a650c546c6e52a91fc2086d7cbbf48faa2 | ||
| if (this.gutter !== -1) { |
There was a problem hiding this comment.
I think you are right on this, I checked OpenLayer's API documentation and ImageWMS class doesn't have a function called setTileGridForProjection. So if you do not filter for the gutter options you might end up with an error in the console (and no layer shown on the map...)
Prevention of doubling of a WMS layer at the opposite site of the globe:
In order to prevent a WMS layer from appearing twice, once in CH and once close to New Zealand, pretty much the same fix as for WMTS was applied.
See: c689f9a
Test link