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

Image source is clipped to -180,180 when terrain is enabled. #4088

Open
Hooterr opened this issue May 7, 2024 · 13 comments
Open

Image source is clipped to -180,180 when terrain is enabled. #4088

Hooterr opened this issue May 7, 2024 · 13 comments
Assignees
Labels
💰 bounty M Medium Bounty, USD 250 bug Something isn't working PR is more than welcomed Extra attention is needed Terrain 3D

Comments

@Hooterr
Copy link

Hooterr commented May 7, 2024

maplibre-gl-js version: 4.2.0

browser: chrome (not important)

Steps to Trigger Behavior

  1. Add a style with terrain
  2. Add an image source that's outside -180,180 longitude
  3. Enable terrain

Link to Demonstration

https://jsbin.com/fiyisil/edit?html,output

const urlWms = "https://placehold.co/600x600/png";
const sourceName = "sourceName";
const wmsLayerName = "wms";
const imageCoordinates = [
    [-20, 60],
    [300, 60],
    [300, -60],
    [-20, -60]
];

map.addSource(sourceName, {
        'type': 'image',
        'url': urlWms,
        'coordinates': imageCoordinates
    });

map.addLayer({
    'id': wmsLayerName,
    'type': 'raster',
    'source': sourceName,
    "paint": {
        'raster-opacity': 0.33,
        'raster-fade-duration': 0
    }
});

Terrain on
image

Terrain off
image

Expected Behavior

Image wraps correctly when terrain is enabled.

Actual Behavior

Image seems to be clipped to -180,180 longitude
Also the opacity seems to be changing when terrain is enabled/disabled

@HarelM
Copy link
Member

HarelM commented May 7, 2024

@HarelM HarelM added the need more info Further information is requested label May 7, 2024
@Hooterr
Copy link
Author

Hooterr commented May 7, 2024

Similar but different. I don't see problems with latitude. In the mentioned issue the problem seems to be with any combination of lat/lng, here the problem seems to be related to some sort of normalizing/clipping to a fixed range of -180,180.
Could be the same root cause though.

@HarelM HarelM added bug Something isn't working Terrain 3D PR is more than welcomed Extra attention is needed and removed need more info Further information is requested labels May 7, 2024
@Panthro22
Copy link

@Hooterr
When the terrain is enabled, it is clipped to a specific tile. The image corner coordinates are then converted to that local tile's coordinate system so it will not go past the Tile edge as it is being cut off to fit that tile, even if it's near the border. If you zoom in to a street-level view, would the image disappear partially or entirely for you? I am asking as there is an issue of zooming in for an image's set near tile z-level of 1.

@Hooterr
Copy link
Author

Hooterr commented May 13, 2024

The image stays partially visible no matter what the zoom level is.

@nbald
Copy link

nbald commented May 18, 2024

Same here, both on FF and Chrome

My company would be happy to offer a $200 bounty for fixing this issue

No terrain:
Screenshot 2024-05-17 at 16-24-46 3D Terrainç

Terrain:
Screenshot 2024-05-17 at 16-24-54 3D Terrain

@nbald
Copy link

nbald commented May 22, 2024

@wipfli could you please add a bounty label on this issue? My company gives a bounty of $200 USD for fixing this

@HarelM HarelM added the 💰 bounty M Medium Bounty, USD 250 label May 23, 2024
@HarelM
Copy link
Member

HarelM commented May 23, 2024

I've added a bounty label, It might be that solving #1559 will solve this issue as well, so there's a change for extra bounty for anyone that is interested.
Note that this issue's bounty will be paid by @nbald's company and not MapLibre.
CC: @ibesora, @sbachinin @neodescis @olsen232 - if any of you is interested in solving this.

@kleenkanteen
Copy link

@HarelM I'm interested in taking this on

@HarelM
Copy link
Member

HarelM commented May 25, 2024

Great! I've signed this to you.

@sbachinin
Copy link
Collaborator

Hard to understand what this issue is about.
Originally it's about clipping to one globe. But the bounty is offered to fix the last example which is clipping to something else.
Two problems are not necessarily the same.
I think we should decide what is actually being fixed here

@HarelM
Copy link
Member

HarelM commented May 26, 2024

To clarify: the 200$ bounty is on the problem @nbald is presenting in his post as his company will pay this bounty.
The other bounty, paid by maplibre, is on the linked issue and not this issue.
I only added the bounty tag here to indicate there's a bounty as per @nbald request.
I hope this is clearer now.
I might be that all these issues are the same root cause, but it might also not be the case.

@sbachinin
Copy link
Collaborator

I also doubt that the bounty problem is sufficiently described. Now there is only a screenshot and I think codepen would be great.
@kleenkanteen, can you reproduce the bug?

@nbald
Copy link

nbald commented May 26, 2024

Here is my issue: https://jsbin.com/cahomamazu/edit?html,output
(same code as @Hooterr's, but with different coordinates)

        const imageCoordinates = [
            [-12, 55.4],
                [16, 55.4],
                [16, 37.5],
                [-12, 37.5]
        ];

Clipping occurs at longitude 0. Come to think of it, it may have more to do with #1559 than this issue.

Anyway. I will offer the $200 bounty for fixing any of #4088 or #1559 or my code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💰 bounty M Medium Bounty, USD 250 bug Something isn't working PR is more than welcomed Extra attention is needed Terrain 3D
Projects
None yet
Development

No branches or pull requests

6 participants