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

MapLibre-GL-JS problem with MBTile source #1716

Closed
mr-sven opened this issue Mar 3, 2025 · 8 comments · Fixed by #1717
Closed

MapLibre-GL-JS problem with MBTile source #1716

mr-sven opened this issue Mar 3, 2025 · 8 comments · Fixed by #1717

Comments

@mr-sven
Copy link
Contributor

mr-sven commented Mar 3, 2025

At the moment I face a problem using MapLibre GL JS and an MBTile source.
The tilejson responds with scheme: tms what is correct I've read because mbtiles are always tms?!?!
It looks like MapLibre GL JS is taking care of that and requests a inverted y axis, but in the mbtiles mod the y axis is inverted again:

let y = invert_y_value(z, y);

So I'm getting no tiles for the specified region. If I point maplibe to a modified tilejson with scheme: xyz it will work.

@mr-sven
Copy link
Contributor Author

mr-sven commented Mar 3, 2025

As soon as every function in mbtiles mod inverts the y axis the tilejson should respond with xyz.
At the moment I'm searching the location for that.

@nyurik
Copy link
Member

nyurik commented Mar 3, 2025

Martin's sources are xyz, regardless of the backend. Users (clients) should not know the type of the data backend, especially because multiple backends can be combined. If the data is coming from an mbtiles, Martin will normalize it.

@mr-sven
Copy link
Contributor Author

mr-sven commented Mar 3, 2025

Ok, so the tilejson should always return xyz?

@nyurik
Copy link
Member

nyurik commented Mar 3, 2025

I believe it always does, unless somehow forced, e.g. with a PG SQL comment. From the looks of it, schema is never set from any metadata fields at

while let Some(row) = rows.try_next().await? {

@mr-sven
Copy link
Contributor Author

mr-sven commented Mar 3, 2025

yes, that's what I also found and currently I'm modifying the source step by step locate the issue why it responds with tms

@mr-sven
Copy link
Contributor Author

mr-sven commented Mar 3, 2025

now it gets worse, I modified the merge_tilejson function to explicit set the scheme and I also logged the scheme of the tilejson object, but the response is tms

@mr-sven
Copy link
Contributor Author

mr-sven commented Mar 3, 2025

Ah, do I miss here something?

{

"scheme":"xyz",
"version":"3.15.0",
"filesize":"601583616",
"format":"pbf",
"id":"openmaptiles",
"maskLevel":"8",
"pixel_scale":"256",
"scheme":"tms",
"tilejson":"2.1.0"
}

scheme is twice in the json, how do that work.

@mr-sven
Copy link
Contributor Author

mr-sven commented Mar 3, 2025

Ok, the scheme is placed in the other map of the TileJSON object because that the get_metadata function does not take care on that:

_ => {
let file = &self.filename();
info!("{file} has an unrecognized metadata value {name}={value}");
tj.other.insert(name, Value::String(value));

I'm working on a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants