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

Exception in dem_data.ts/backfillBorder #1551

Open
cns-solutions-admin opened this issue Aug 26, 2022 · 8 comments
Open

Exception in dem_data.ts/backfillBorder #1551

cns-solutions-admin opened this issue Aug 26, 2022 · 8 comments
Labels
bug Something isn't working need more info Further information is requested

Comments

@cns-solutions-admin
Copy link
Contributor

cns-solutions-admin commented Aug 26, 2022

The initial loading/drawing of the map fails, because of a "dem dimension mismatch".
When debugging I saw that sometimes this.dim = 512, while borderTile.dim = 256.
However there is only one .mbtiles dem source created according https://demotiles.maplibre.org/terrain-tiles/ (the tile size is 256, although the pngs are 512x512, like in https://maplibre.org/maplibre-gl-js-docs/example/3d-terrain/)

I first thought this happens, because tileserver-gl returns 204 on missing tiles, but it also happens with mbtileserver, which returns 404. Still, it might have to do with missing tiles?

(After dragging the empty div, where the map should be, the map loads and everything works fine.)

maplibre-gl-js version: 2.3.0

browser: any

Steps to Trigger Behavior

  1. configure map with terrain on and initial bounds that include a non-existing tile (?)
  2. open map
  3. logs error "dem dimension mismatch" and no map is drawn
  4. drag the map area
  5. map is drawn

Link to Demonstration

Expected Behavior

Missing tiles are ignored

Actual Behavior

Keeps the map from drawing initially.
After some mouse action on the (empty) map area, map starts loading and is drawn.

@cns-solutions-admin cns-solutions-admin changed the title Exception on DEM tile status 204 Exception in dem_data.ts/backfillBorder Aug 26, 2022
@HarelM
Copy link
Collaborator

HarelM commented Aug 26, 2022

If you need help understanding the issue I suggest sharing the problematic code, otherwise you're on your own...

@HarelM HarelM added bug Something isn't working need more info Further information is requested labels Aug 26, 2022
@acalcutt
Copy link
Contributor

acalcutt commented Aug 26, 2022

I've actually wondered if that "tileSize: 256" in the terrain demotiles should just be removed or changed to 512 before. The demo terrain tiles there I made with rio rgbify should be 512px, if I understand right from this rio rgbify thread

I never noticed it causing an issue like you mention here though

@acalcutt
Copy link
Contributor

acalcutt commented Aug 26, 2022

I think this demo meets your description, but it doesn't seem to have an issue
https://stackblitz.com/edit/web-platform-yhtksh?file=index.html

However, I remembered when I was testing terrain attribution with the tile source in #1513 I was having this really weird issue where the map would blank out at different zoom levels.... I wonder if that is similar. I tried to recreate that here and still experience issue
https://stackblitz.com/edit/web-platform-nnbpfy?file=index.html
(zoom out five times, then center to terrain region Slovensko and zoom in a few times and the raster disappears. if you keep zooming in it eventually comes back.)

Is this similar to what you are seeing?
1b
(second half)
2

Edit: looking at you description more this probably isn't the same issue since I don't see that error anywhere. though when i had it originally it was also using a raster of just the 'Slovensko' area, but it centered outside that area where no tiles existed. when I zoomed out to find it I experienced the weird map redraw issue.

@cns-solutions-admin
Copy link
Contributor Author

After some more analysis with a simple test page:

  1. using the tiles from the example https://maplibre.org/maplibre-gl-js-docs/example/3d-terrain/: returns 404 not found - respective error messages on console, but no terrain errors
  2. using tiles from tileserver-gl: returns 204 no content => "Error: Could not load image because of An attempt was made to use an object that is not, or is no longer, usable. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported." in Evented
  3. using mbtileserver: returns transparent 256x256 tile for missing tile => "Uncaught Error: dem dimension mismatch" in DEMData

Our full application (with tileserver-gl) now also gets error 2 (not sure what changed), but the error here somehow prevents the map from loading (probably something to do with it being a React app).

As 1. works and 3. is clearly a mbtileserver problem (added issue consbio/mbtileserver#154), the question is, if maplibre-gl should handle 204 similar to 404 instead of trying to parse the empty result as JSON or image?

@cns-solutions-admin
Copy link
Contributor Author

cns-solutions-admin commented Aug 29, 2022

Just found out that tileserver-gl and others intentionally return 204 on tile not found: maptiler/tileserver-gl#46

Thus HTTP result 204 should not even be logged as error, as already requested (but closed as stale) in #160

@HarelM
Copy link
Collaborator

HarelM commented Aug 29, 2022

Feel free to revisit this PR and issue (#161).
I was under the impression this was merged and fixed, apparently it wasn't.
There's a linked PR that wasn't going anywhere where there is a fix apparently.
I suggest to open a new one and link to it.
I have low expectations it will solve your case, but it wouldn't hurt to try :-)

@cns-solutions-admin
Copy link
Contributor Author

Created #1579 for HTTP result 204/404 handling.

However, the problem that the map does not load, seems to be unrelated to 204/404 handling.
A workaround seems to be to start the map in non-terrain mode and let the user switch to terrain using the control.

@HarelM
Copy link
Collaborator

HarelM commented Nov 19, 2023

I'm not sure I understand if this is still an issue or not.
Please provide a way to reproduce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants