Skip to content

Fix_BGDIINF_SB-2682 no more doubling of wms layers on other side of globe#321

Merged
hansmannj merged 2 commits intodevelopfrom
fix_BGDIINF_SB-2682_no_more_doubling_of_wms_layers_on_other_side_of_globe
Dec 12, 2022
Merged

Fix_BGDIINF_SB-2682 no more doubling of wms layers on other side of globe#321
hansmannj merged 2 commits intodevelopfrom
fix_BGDIINF_SB-2682_no_more_doubling_of_wms_layers_on_other_side_of_globe

Conversation

@hansmannj
Copy link
Member

@hansmannj hansmannj commented Dec 7, 2022

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

@github-actions github-actions bot added the bug label Dec 7, 2022
@hansmannj hansmannj marked this pull request as draft December 7, 2022 10:30
@hansmannj hansmannj changed the title Fix bgdiinf sb 2682 no more doubling of wms layers on other side of globe Fix_BGDIINF_SB-2682 no more doubling of wms layers on other side of globe Dec 8, 2022
@hansmannj hansmannj force-pushed the fix_BGDIINF_SB-2682_no_more_doubling_of_wms_layers_on_other_side_of_globe branch from c79d4d8 to a18bdc8 Compare December 8, 2022 14:26
@hansmannj hansmannj marked this pull request as ready for review December 8, 2022 15:10
…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
@hansmannj hansmannj force-pushed the fix_BGDIINF_SB-2682_no_more_doubling_of_wms_layers_on_other_side_of_globe branch from a18bdc8 to 05583ea Compare December 8, 2022 15:11
@hansmannj hansmannj requested a review from pakb December 8, 2022 15:11
Comment on lines +78 to +91
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,
})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member Author

@hansmannj hansmannj Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@hansmannj hansmannj requested a review from pakb December 12, 2022 12:18
// 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) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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...)

Copy link
Contributor

@pakb pakb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

// 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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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...)

@hansmannj hansmannj merged commit ef4f885 into develop Dec 12, 2022
@hansmannj hansmannj deleted the fix_BGDIINF_SB-2682_no_more_doubling_of_wms_layers_on_other_side_of_globe branch December 12, 2022 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants