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

[BUG] {d} urlTemplate placeholder improperly converted to string on non-web platforms #1936

Open
geoextra opened this issue Jul 23, 2024 · 3 comments · May be fixed by #1940
Open

[BUG] {d} urlTemplate placeholder improperly converted to string on non-web platforms #1936

geoextra opened this issue Jul 23, 2024 · 3 comments · May be fixed by #1940
Labels
bug This issue reports broken functionality or another error P: 2 (soon™?) S: core Scoped to the core flutter_map functionality

Comments

@geoextra
Copy link

geoextra commented Jul 23, 2024

What is the bug?

When using the {d} in the urlTemplate (introduced in #1665) it defaults to a float value which gets converted to string (e.g. 256.0). This is obviously not supported by many tile providers.

How can we reproduce it?

Use the following option: urlTemplate: 'https://api.mapbox.com/styles/v1/mapbox/streets-v12/tiles/{d}/{z}/{x}/{y}{r}?access_token=$mapboxPublicToken'. The tile server will respond with 422 status codes.
Problem doesn't occur on web due to differences in types and therefore toString().

Do you have a potential solution?

I don't see why the resolution needs to be a double, maybe it can be changed to an integer type.

Platforms

Android 14

Severity

Erroneous: Prevents normal functioning and causes errors in the console

@geoextra geoextra added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Jul 23, 2024
@JaffaKetchup
Copy link
Member

Hey @geoextra, can you confirm if you mean the {d} placeholder instead? {r} is for retina mode.

(If you want to use x512 tiles, you can set tileSize: 512, use 512 or {d} (when fixed) in the URL, and set zoomOffset: -1.)

@geoextra geoextra changed the title [BUG] using the resolution placeholder {r} generates invalid URLs on some platforms [BUG] using the resolution placeholder {d} generates invalid URLs on some platforms Jul 26, 2024
@geoextra
Copy link
Author

Yes, of course, I edited the title, thanks.

@JaffaKetchup JaffaKetchup changed the title [BUG] using the resolution placeholder {d} generates invalid URLs on some platforms [BUG] {d} urlTemplate placeholder improperly converted to string on non-web platforms Aug 2, 2024
@JaffaKetchup
Copy link
Member

I'm not sure why we accept decimals for the tile size, that really doesn't make sense.

A less intrusive short term fix is to just assume the number is an integer before converting it (which it should be), otherwise fall back to this behaviour.

We'll discuss internally which is best. Thanks for the report!

@JaffaKetchup JaffaKetchup added P: 2 (soon™?) S: core Scoped to the core flutter_map functionality and removed needs triage This new bug report needs reproducing and prioritizing labels Aug 2, 2024
@JaffaKetchup JaffaKetchup linked a pull request Aug 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error P: 2 (soon™?) S: core Scoped to the core flutter_map functionality
Projects
Status: To do
Development

Successfully merging a pull request may close this issue.

2 participants