Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XYZ source opacity problem #239

Open
MichalPoty opened this issue Aug 18, 2023 · 5 comments
Open

XYZ source opacity problem #239

MichalPoty opened this issue Aug 18, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@MichalPoty
Copy link

MichalPoty commented Aug 18, 2023

Describe the bug
I have ol-tile-layer and ol-source-xyz with url to xyz source. However, when I set the ol-tile-layer layer opacity to 1 (100%), an unwanted white background appears outside the layer area.

My xyz layer is not over the whole world as in the example, but just a square area as you can partly see in the screenshots.

temporary solution:
When I set the opacity to any other value less than 1, for example 0.99, the white background disappears.

illustration code:
<ol-tile-layer :opacity="opacity"> <ol-source-xyz :url="url + '{z}/{x}/{-y}.png'" /> </ol-tile-layer>

1.2.0

Please run npm list --depth=0 vue vue3-openlayers ol ol-ext ol-contextmenu and paste the output below:
├── ol-contextmenu@5.2.1
├── ol-ext@4.0.10
├── ol@7.4.0
├── vue@3.3.4
└── vue3-openlayers@1.2.0

Screenshots
Image 1 (Bug) - Sattelite image is my XYZ area, white background has nothing to do there, opacity == 1.
opacityIssue

Image 2 - Image is correct, opacity is set to 0.99, the white background disappears.
opacityRight

@MichalPoty MichalPoty added the bug Something isn't working label Aug 18, 2023
@d-koppenhagen
Copy link
Collaborator

Hey, @MichalPoty , this could a problem from OpenLayers itself. However, to make it more easy to reproduce, can you please setup a playground using the Stackblitz starter template?

@MichalPoty
Copy link
Author

I found the problem. It's because of projection... Default projection EPSG:4326 works fine, but I'm using EPSG:3857 and it's causing that unwanted white background to be rendered. I'm not sure if it's an OL bug, or if it could be caused by my xyz source.

Unfortunately I can't provide playground with my data. Examples sources in the official OL are not the ones to demonstrate this problem on, because they cover the whole world and you can't see the white background... I would need some public xyz source that doesn't cover the whole world, but just a cutout of some area.

@d-koppenhagen
Copy link
Collaborator

Okay. So as this lib passes through the properties for projection directly to OpenLayers I assume it's a problem (or not when using an appropriate projection) from OpenLayers or the source.
I will close this issue.

@d-koppenhagen d-koppenhagen reopened this Sep 11, 2023
@d-koppenhagen d-koppenhagen closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2023
@epou
Copy link

epou commented Jun 3, 2024

I discovered something interesting today: it seems that OpenLayers defaults 'opaque' to false (as per their documentation here: https://openlayers.org/en/latest/apidoc/module-ol_source_XYZ-XYZ.html), whereas in vue3-openlayers, it's set to 'true' by default:

I managed to solve the issue by explicitly setting :opaque="false" -> <ol-source-xyz url='https://example.com' :opaque="false">.

@d-koppenhagen
Copy link
Collaborator

Interesting. I think it's better to align the defaults and probably this behavior was not implemented by intention. However, I think I will align the defaults in the future and introduce a breaking change. This will be documented of course. Thanks for digging into it. I will let this issue open since the behavior is not that clear currently.

@d-koppenhagen d-koppenhagen reopened this Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants