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

Fix: Rescale vector tiles depending on dpi in print #1911

Merged
merged 6 commits into from
Dec 12, 2023

Conversation

sweco-seguro
Copy link
Contributor

The olms extension now rescales mapbox vector tiles when changing the dpi of a print.

The extension creates one style for each configured print resolution, which is then applied when said print resolution is chosen.

Fix for #1801

Added rescaling functionality in the olms extension.
The extension creates one style for each configured
print resolution, which is then applied when
said print resolution is chosen.
Remove extensions.js which was mistakenly added from the PR.
Copy link
Contributor

@jokd jokd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to test this but it looks good so I suggest we merge it

@Grammostola
Copy link
Contributor

There are one or two changes incoming

Created a general method for scaling mapbox vector tiles
to avoid duplicated almost identical code.

The method is only used if the layer is of format 'mvt'
to avoid applying it to regular vector tile layers.
Style-type is now used instead of layer format to determine
how to rescale the style of a mapbox vector tile.
Circles in the mapbox vector tile style is now rescaled
in the same way as other style elements.
@Grammostola
Copy link
Contributor

There's a minor niggle with an error when the print preview exits, a default param is given a null value, else it looks good.

There are two potential discussion points:

  • The Olms extension now takes a config object with a possible list of resolutions in the case that the print has somehow been initialized with different resolutions than the current ones (75, 150, 300).
  • The fill-pattern paint prop for polygons can look slightly funny at 75 and 300 dpi. Not "obviously wrong" that I've seen but not optimal always either. The prop can acc to the spec refer to a raster (not a vector graphic, I asked the mapbox style spec resident AI) in the spritesheet or another image. https://docs.mapbox.com/style-spec/reference/layers/#paint-fill-fill-pattern . With "spritezero" a spritesheet can be created from .svg-graphics for hiDPI displays and standard displays and ol-mapbox-style I'd guess detect the display and apply the "2x" sprite sheet or the normal one. Inside one sprite sheet there can be several rules with several different raster images for the same layer at different zoom levels. "Different print dpis" isn't so much a concept unless we choose to apply it, that is to say make the print control suppose style rules with a distinct print-dpi-related name and those rules and images would need to be in (each) style sheet.

Removed null as argument from ScaleMapboxLayer
@Grammostola Grammostola merged commit e026d3b into origo-map:master Dec 12, 2023
3 checks passed
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

Successfully merging this pull request may close these issues.

3 participants