-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add options for ratio and tileType #44
Add options for ratio and tileType #44
Conversation
Thanks for the png option. Looks like a good addition to me! |
it seems size wise, webp could actually be the smallest sized images based on the screenshot above. I wonder what the compatibility of webp is these days |
raw: { | ||
premultiplied: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
premultiplied was added in sharp 0.28.2 :-) lovell/sharp#1599 (comment)
So no need to Un-premultiply anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you! Ratio=2 looks great at high zoom levels with some styles with imagery tiles and OSM labels that I've been working with.
Thanks for the quick review @rudokemper. Can you make an NPM release with this new feature? |
Sure thing, done. |
Just an FYI since I didn't note it. You can have a ratio higher than 2, it just increases your tile image size the more you raise it. Tileserver GL accepts a max ratio of 3 by default, but can go all the way up to a ratio of 9 depending on your options. |
I don't really have a use yet, but I have wanted to make a rendered mbtiles in the past for some atv trail ideas I have had. sometimes on trails the cell signal is low, so using web based maps isn't ideal. I'd love eventually to make a maplibre-native android app with local tiles that can be used offline. In the past I have tried to make tiles using Qtiles, like On the maplibre-native side, I know I have seen request for something like this in Really, mostly I was bored over the weekend and saw something I could contribute here. hope to see more progress on this. Now I am trying to figure out how to speed it up at higher zoom levels. I was trying a few suggestions from google code AI which were good starts, but so far nothing successful. I am trying generate a full planet zoom 14, but it is looking like that would take a month...haha |
Super cool, thanks for sharing! Our use case is Indigenous users in an offline context who need maps for data collection or visualization, but I figured the tool could be helpful for a lot of different use cases. So it's affirming to read about other interests, and contribute something back to the broader Maplibre community that everyone can use. (On an somewhat related note, over at Terrastories we're super grateful for the recent love you and others have given Tileserver-GL, and in particular support for arm architecture has been great for deploying the tool on low energy devices!) |
I'd imagine at minimum it helps make overzooming look sharper. So if you made a low max zoom tile (like say zoom 9) and you were zoomed into zoom 14, a ratio 1 tile would probably be very blury, but a ratio 5 tile may still look decent, since it is basically the size it should be for that zoom level. |
Glad my work on maplibre-native node and tileserver-gl is helpful to others :-). I have probably spent way to much time on getting that working |
Goal
Adds cli options for 'pixel ratio' and 'tiletype' to allow changing the type of tiles generated from 'jpg', 'png', or 'webp'. It defaults to a ratio of 1 and tiletype of 'jpg', which were the old hardcoded defaults.
Screenshots
with ratio 1, tiletype webp
`node . --style self --stylelocation styles\http_pmtiles_local_spites_fonts.json --stylesources styles\data --bounds "-79,37,-78,38" -Z
with ratio 2, tiletype webp
node . --style self --stylelocation styles\http_pmtiles_local_spites_fonts.json --stylesources styles\data --bounds "-79,37,-78,38" -Z 11 -f wdb_11_r2_webp -r 2 -t webp
with ratio 1, tiletype png
node . --style self --stylelocation styles\http_pmtiles_local_spites_fonts.json --stylesources styles\data --bounds "-79,37,-78,38" -Z 11 -f wdb_11_r1_png -r 1 -t png
with ratio 2, tiletype png
with ratio 1, tiletype jpg
node . --style self --stylelocation styles\http_pmtiles_local_spites_fonts.json --stylesources styles\data --bounds "-79,37,-78,38" -Z 11 -f wdb_11_r1_jpg -r 1 -t jpg
with ratio 2, tiletype jpg