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

tile-avoid-edges test failure #479

Closed
acalcutt opened this issue Sep 13, 2022 · 22 comments
Closed

tile-avoid-edges test failure #479

acalcutt opened this issue Sep 13, 2022 · 22 comments
Labels
bug Something isn't working

Comments

@acalcutt
Copy link
Collaborator

I am trying to track down this issue on my tileserver-gl fork acalcutt/tileserver-gl#5 . From what it looks like, it seems like only 1 of the 4 tiles is getting displayed.

I was looking through the render tests and I found this failed test that looks similar.
render-tests/map-mode/tile-avoid-edges

When the test runs, the result looks like this
actual

however, it expects this
expected

To Reproduce
Steps to reproduce the behavior:
1.) On Ubuntu/Debian, Follow the build steps at https://github.com/maplibre/maplibre-gl-native/tree/main/platform/linux
2.) xvfb-run -a ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json --filter "render-tests/map-mode/tile-avoid-edges"
3.) Look at 'maplibre-gl-native/maplibre-gl-js/test/integration/render-tests/map-mode/tile-avoid-edges' generated actual image compared to expected. Also look at 'maplibre-gl-native-ac/metrics/macos-xcode11-release-style.html
4.) The console will also report a bunch of errors like the user reports "Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode"

# xvfb-run -a ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json --filter "render-tests/map-mode/tile-avoid-edges"
[WARNING] {mbgl-render-tes}[ParseStyle]: The 'width' metadata field is ignored in tile map mode
[WARNING] {mbgl-render-tes}[ParseStyle]: The 'height' metadata field is ignored in tile map mode
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
[INFO] {mbgl-render-tes}[General]: GPU Identifier: llvmpipe (LLVM 11.0.1, 256 bits)
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
* failed render-tests/map-mode/tile-avoid-edges
1 failed (100.0%)

Just one note, this test says it passes if i run it with "--manifestPath metrics/linux-clang8-release-style.json", but it still gets these errors and the results look the same.

Platform information (please complete the following information):

  • OS: Debian 11
  • Platform: Node.js
  • Version: current repo
@acalcutt
Copy link
Collaborator Author

acalcutt commented Sep 13, 2022

Another interesting note. when I test what the user posted with my own style by going to
https://tiles.wifidb.net/styles/WDB_OSM/static/13.389587,52.515359,12/500x500.png

I get this image, which you can see the background color and hillshade I have in my style cover the whole image, just the openmaptiles layers seem trimmed off
500x500

@roblabs
Copy link
Collaborator

roblabs commented Sep 15, 2022

For future research into this issue:

The logging events for ...

[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.
[WARNING] {mbgl-render-tes}[General]: Provided camera options returned 4 tiles, only 13/2099/3045=>13 is taken in Tile mode.


... comes from the C++ logic here:

https://github.com/maplibre/maplibre-gl-native/blob/main/src/mbgl/renderer/tile_pyramid.cpp#L125,L132

        idealTiles = util::tileCover(parameters.transformState, idealZoom, tileZoom);
        if (parameters.mode == MapMode::Tile && type != SourceType::Raster && type != SourceType::RasterDEM &&
            idealTiles.size() > 1) {
            mbgl::Log::Warning(mbgl::Event::General,
                               "Provided camera options returned %zu tiles, only %s is taken in Tile mode.",
                               idealTiles.size(),
                               util::toString(idealTiles[0]).c_str());
            idealTiles = {idealTiles[0]};
        }

@acalcutt
Copy link
Collaborator Author

Looking at mapbox/mapbox-gl-native@9ceb619 , that was actually the last commit made to that file on Apr 24, 2020

@acalcutt
Copy link
Collaborator Author

acalcutt commented Sep 15, 2022

I tried removing that block of code and re-runing the test and it looks like it fixed the trimming at tile boarders. The test still fails but this seems to fix the issue I am talking about.

The 'actual.png' looks like this now
actual

@birkskyum
Copy link
Member

birkskyum commented Sep 15, 2022

@acalcutt , so would it fix the issue to be in another mode than tile mode, so this "parameters.mode == MapMode::Tile" becomes false? Is there still a problem in the library, or can you adjust the configuration you have to resolve it?

@birkskyum birkskyum added bug Something isn't working node labels Sep 15, 2022
@acalcutt
Copy link
Collaborator Author

acalcutt commented Sep 16, 2022

I just tested turning off tile mode on my server and going to https://tiles.wifidb.net/styles/WDB_OSM/static/13.389587,52.515359,12/500x500.png

And yes, it seems to look fine in the default mode

Looks like this in static mode
500x500 (1)

and this in tile mode
500x500 (2)

(I put back the tile mode btw because I need it for the label clipping issue)

@birkskyum
Copy link
Member

Awesome! Can this issue be closed?

@acalcutt
Copy link
Collaborator Author

not really, it's still a tile mode bug I think. I can research in the tileserver if I can switch the mode in a static image request, but that wasn't needed before with the last mapbox release.

@acalcutt
Copy link
Collaborator Author

Also, the test I noted is still not right. so I would say it was expected to work like that at one point

xvfb-run -a ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json --filter "render-tests/map-mode/tile-avoid-edges"

@acalcutt
Copy link
Collaborator Author

BTW, I know this was marked as node, but I think the test shows this isn't just a node issue. The test is on the linux build test runner.

@acalcutt
Copy link
Collaborator Author

acalcutt commented Sep 16, 2022

Any opinions on making PR to remove mapbox/mapbox-gl-native@9ceb619

Does this block of code make sense? The image generated by this test obviously has 4 tiles, so why would it be limited to 1? If you were centered on a tile and the view didn't included any of the other tiles it may make sense..., but here, where the view does included multiple tiles, does it make sense? to me not really.

I looked a bit into the tileserver code and changing the mode for static images, but keeping it tile mode for everything else would be difficult since it sets up a pool of renders when it loads and uses them later when the pages are requested. I couldn't see a way to switch tile modes unless I set up static renderers up front, which would add a lot of duplicate code. Unfortuanly tile mode is needed for everything but static images, so it can't just be turned off

@roblabs
Copy link
Collaborator

roblabs commented Sep 16, 2022

Removing the code does indeed break the rendering in the iOS test app Edit: The previous statement is wrong, no way to strike out. See updated comment at bottom of issue..


But we may look at how the Node static path gets into this C++ code. The code says, "If the type is not a raster and more than one tile is requested, then only return the first tile."

This makes the entry point from TileServer-GL a bit difficult, as we would want to convert a vector ( != SourceType::Raster) into a static raster.

        idealTiles = util::tileCover(parameters.transformState, idealZoom, tileZoom);
        // my reformatting for clarity
        if (parameters.mode == MapMode::Tile &&
            type != SourceType::Raster &&
            type != SourceType::RasterDEM &&
            idealTiles.size() > 1) {
            // continue

@acalcutt
Copy link
Collaborator Author

acalcutt commented Sep 16, 2022

I guess it not affecting Raster and RasterDEM explains why my hillshade and color raster still covers the entire image in this test https://user-images.githubusercontent.com/3792408/190528875-38a02b33-54e1-428c-8471-be1df367b1e8.png

@birkskyum birkskyum removed the node label Sep 16, 2022
@acalcutt
Copy link
Collaborator Author

acalcutt commented Sep 17, 2022

Question @roblabs you mention this breaking the iOS test app. Is the actual app broken or are the render tests just failing?

I notice in my fork where I made this change, the macos render tests end in "Process completed with exit code 1.", however the amount of failed tests and warning has not changed. for example,

In the latest run, it got this
https://github.com/acalcutt/maplibre-gl-native/actions/runs/3064374630/jobs/4947993366

1173 passed (89.4%)
13 passed but were ignored (1.0%)
78 ignored (5.9%)
32 failed (2.4%)
16 errored (1.2%)
Results at: /Users/runner/work/maplibre-gl-native/maplibre-gl-native/metrics/macos-xcode11-release-style.html
Error: Process completed with exit code 1.

But in a previous run that worked, it got the same number of errors.
https://github.com/acalcutt/maplibre-gl-native/actions/runs/2940272842/jobs/4695931350

1173 passed (89.4%)
13 passed but were ignored (1.0%)
78 ignored (5.9%)
32 failed (2.4%)
16 errored (1.2%)
Results at: /Users/runner/work/maplibre-gl-native/maplibre-gl-native/metrics/macos-xcode11-release-style.html

Strange that the first one, the one after removing that block, gets the same errors but fails at the end

@roblabs
Copy link
Collaborator

roblabs commented Sep 17, 2022

@acalcutt — I took another look at this today, and I was wrong, rendering is not broken as I mentioned in #479 (comment). I had the wrong lines commented out in my smoke test.

I think your analysis and testing criteria is correct. Since the change mapbox/mapbox-gl-native@9ceb619 is related to macOS, your approach to rendering tests in macOS is the right way to go.

We should also review all camera tests across all platforms (QT, macOS, Linux, Android, iOS) to verify nothing else is broken. It is possible that the TileServer GL Static path is one of the best and most flexible camera tests we have among all platforms.

@acalcutt
Copy link
Collaborator Author

acalcutt commented Sep 17, 2022

I'm still confused why removing that block causes a rendering test "Process completed with exit code 1" in my workflow. when i try the render test on linux it ends right with exit code 0. I tested putting it back and the workflow succeeds. strange.

trying to set up an old mac laptop I have collecting dust to see if i can run the test there.

acalcutt added a commit to WifiDB/maplibre-gl-native that referenced this issue Sep 19, 2022
This reverts commit 9ceb619. for maplibre#479 .

If the tile returned is off center, this causes vector layers to be missing on the tiles that were not included
@acalcutt acalcutt reopened this Dec 14, 2022
@lseelenbinder
Copy link
Member

For what it's worth, Tile mode is used in combination with when you set your camera to the center of a single XYZ tile. It's primarily used to render individual tiles as images for use elsewhere (e.g., server-side for use in leaflet).

@acalcutt
Copy link
Collaborator Author

acalcutt commented Dec 14, 2022

I've re-opened this due to my testing of tileserver issue maptiler/tileserver-gl#649 .

While it isn't 100% the same, it does get the same error as above, which led me to this test in the first place.

mlgl: {
  class: 'General',
  severity: 'WARNING',
  text: 'Provided camera options returned 4 tiles, only 11/1058/697=>11 is taken in Tile mode.'
}

In this new tileserver issue, I think the image is centered, but the TileMargin extends the width/height of the rendering by a certain amount of pixes on all sides.

For example, in the test files the user provided, I focused on these two images
http://192.168.0.103:8080/styles/topomap/12/2117/1394.png
http://192.168.0.103:8080/styles/topomap/12/2118/1394.png
which, in the current maplibre, makes two files like this
207463889-2d3750a2-2369-448b-8292-a688d4748a42

However, with mapbox/mapbox-gl-native@9ceb619 revered it makes two images like this
207463938-0cfb1e27-4f50-4db3-8592-e98194a7548f

The parameters for the images, with tile mode look like this. TileMargin has increased rendering width/height by 20 (10x2)

mode: tile
params: {
  zoom: 11,
  center: [ 6.1083984375, 49.69606181911566 ],
  bearing: 0,
  pitch: 0,
  width: 276,
  height: 276
}
GET /styles/topomap/12/2117/1394.png 200 304.787 ms - 89986
mode: tile
params: {
  zoom: 11,
  center: [ 6.1962890625, 49.69606181911566 ],
  bearing: 0,
  pitch: 0,
  width: 276,
  height: 276
}
GET /styles/topomap/12/2118/1394.png 200 261.025 ms - 81071

@lseelenbinder
Copy link
Member

I see @acalcutt. If I understand correctly, what you're doing can't be combined with TileMode (nor do I think it should), since TileMargin almost always implies you'll need more than one vector tile.

@lseelenbinder
Copy link
Member

(That being said, the label clipping is probably the key issue you're highlighting, and I think that is problematic. :) )

@acalcutt
Copy link
Collaborator Author

acalcutt commented Dec 14, 2022

Without TileMargin, the images still look like the first example. and with tile mode not enabled, other types of labels have a clipping issue like #284 which was fixed by getting tile mode working again.

@acalcutt
Copy link
Collaborator Author

acalcutt commented Dec 14, 2022

I expected the fix for tile mode in #284 would have fixed this label issue, but it doesn't. the labels fixed in that issue are still fine.

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

4 participants