-
Notifications
You must be signed in to change notification settings - Fork 638
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
Replace formatQuality
with formatOptions
for additional configurability
#1327
Conversation
src/serve_rendered.js
Outdated
const formatQuality = (options.formatQuality || {})[format]; | ||
const formatOptions = (options.formatOptions || {})[format] || {}; |
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.
Feels like options.formatQuality
should still be supported (IOW, when people would update to a new version, they suddenly wouldn't get lower or higher qualities than what they expect), maybe log a deprecation warning though?
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.
ok, this is done. formatQuality
is still supported but will produce a deprecation warning if it's found. formatOptions
is preferred over formatQuality
.
f5f2620
to
c5895d9
Compare
b5e3fe7
to
304743b
Compare
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.
I think this looks good and offers a good path for people using the old option.
One thing to note is when testing the 4 colors noted in the documentation I did see some text that had different colors, i think it was text that crosses the tile border.
not sure this is fixable since the colors are being determined per tile
formatQuality is more flexible and allows configuration of more than just quality for all formats. JPEG and WebP still have only their quality configurable. PNG has all the configuration options from the sharp library exposed. Signed-off-by: Nathan Reed <[email protected]>
Signed-off-by: Nathan Reed <[email protected]>
Signed-off-by: Nathan Reed <[email protected]>
304743b
to
1036155
Compare
yeah, I noticed this in testing too. Unfortunately |
I wouldn't mind a PR to change the docs to better defaults that are less likely to cause issues. |
Should this configuration parameter work with mbtiles with png tiles? For example, if I use mapTiler to build a mbtiles file, and select PNG as the output format, can I assume that |
It would not apply to your data files, so it would not change the png images inside your mbtiles. tiles that are rendered like the style raster endpoints or static image endpoints would be changed by this. |
I understand this will not change the files within the mbtiles, and to clarify I meant the rendered tiles that the tileserver serves from within the mbtiles - that is, will this change apply to the tiles rendered on the fly FROM the mbtiles file, served by tileserver? I guess I don't totally understand how these options are apply, or where, or to what. |
It will not change the pngs served from you data files either. It serves those as is Like i said, it only affects rendered images, so that would be the rendered 'raster' endpoint under styles or the image endpoints under styles. If you wanted to render your data files with different format options, you could make a style that uses that data source and include it as a layer. then the resulting images from your style would be rendered with the formatOptions you set. |
Per the (brief) discussion #1281, this PR replaces the
formatQuality
option in the config file withformatOptions
.The documentation is also updated with examples for the previous JPEG and WebP quality settings as well as the new PNG options.