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

[FEATURE] Add TileLayer urlTemplate placeholder for tileSize #1664

Closed
bramp opened this issue Sep 27, 2023 · 1 comment · Fixed by #1665
Closed

[FEATURE] Add TileLayer urlTemplate placeholder for tileSize #1664

bramp opened this issue Sep 27, 2023 · 1 comment · Fixed by #1665
Labels
feature This issue requests a new feature P: 3 (low) (Default priority for feature requests)

Comments

@bramp
Copy link
Contributor

bramp commented Sep 27, 2023

What do you want implemented?

TileLayer accepts a tileSize as well as a urlTemplate. Mapbox supports Static Tile URLs of the form https://api.mapbox.com/styles/v1/{username}/{style_id}/tiles/{tilesize}/{z}/{x}/{y}{@2x}

When using Mapbox you need to specify the tileSize twice, e.g

TileLayer(
   tileSize: 512,
   urlTemplate: 'https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/512/{z}/{x}/{y}{r}?access_token={accessToken}',
)

This can be error prone.

My proposal is a new placeholder, {d} (for dimension) that is replaced with the tile size, so I can now provide a url like 'https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/{d}/{z}/{x}/{y}{r}?access_token={accessToken}' and not worry about ensuring I write 512 twice.

What other alternatives are available?

A little bit of duplication

Can you provide any other information?

Happy to send a very modest (one-line) patch.

Severity

Annoying: Currently have to use workarounds

@bramp bramp added feature This issue requests a new feature P: 3 (low) (Default priority for feature requests) labels Sep 27, 2023
@JaffaKetchup
Copy link
Member

JaffaKetchup commented Sep 27, 2023

This should be relatively easy. One interesting thing to note is that they don't actually have to match. Add to this retina mode, and it can all be quite confusing, with some combinations seemingly having no effect.
I should be able to get a PR for this done.

@JaffaKetchup JaffaKetchup changed the title [FEATURE] Add placeholder for tile size [FEATURE] Add TileLayer urlTemplate placeholder for tileSize Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue requests a new feature P: 3 (low) (Default priority for feature requests)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants