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

High resolution tiles? #156

Open
chriscdn opened this issue May 15, 2024 · 7 comments
Open

High resolution tiles? #156

chriscdn opened this issue May 15, 2024 · 7 comments

Comments

@chriscdn
Copy link

Is there a setting or option for increasing the map resolution (e.g., retina tiles)?

I know tileSize can be used to increase the map resolution with Leaflet, but I don't see this as an option to protomapsL.leafletLayer. Is there a way to do this?

@bdon
Copy link
Member

bdon commented May 16, 2024

The tile resolution should match your devicePixelRatio and be the ideal resolution automatically, so there isn't a way to set it:

https://github.com/protomaps/protomaps-leaflet/blob/main/src/frontends/leaflet.ts#L107

@chriscdn
Copy link
Author

Thanks, I see that now. I was using it in a headless environment, and was able to apply it by setting the deviceScaleFactor.

It would be great if this could be made into an optional parameter (defaulting to devicePixelRatio) for such cases. I'd be happy to submit a pull request.

@bdon
Copy link
Member

bdon commented May 16, 2024

In the case you described shouldn't setting deviceScaleFactor in Puppeteer be sufficient for control over this?

@chriscdn
Copy link
Author

I suppose my concern is introducing side effects in my application by changing deviceScaleFactor. However, it does seem to work. I just prefer more explicit parameters to clearly define behaviour, rather than depending on a global that's set in a completely different area of my application. A parameter would make it clear.

@bdon
Copy link
Member

bdon commented May 20, 2024

I agree, do you want to try a PR where devicePixelRatio is an option to leafletLayer?

@chriscdn
Copy link
Author

Sure, I'd be happy to. However, I see window.devicePixelRatio is also used in a few other locations. I could extend these interfaces in a similar way.

Should the parameter be named scale or something, which defaults to window.devicePixelRatio? Naming the parameter devicePixelRatio might be confusing since you're not actually changing the device pixel ratio. :)

@bdon
Copy link
Member

bdon commented May 28, 2024

scale can mean something different and I think devicePixelRatio used like

this.devicePixelRatio || window.devicePixelRatio

is the most straightforward...

since you're not actually changing the device pixel ratio

It seems fine to me if the main use case is for headless "devices", right?

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

No branches or pull requests

2 participants