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

Report WMS scale denominators (scale hints) #70

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ejn
Copy link

@ejn ejn commented Sep 25, 2024

This adds support for reporting the minScaleDenominator and maxScaleDenominator from WMS layers in the API, which may be passed e.g. to OpenLayers to ensure that WMS calls are only made when the layer is in the visible range.

The resolution values from ScaleHint in WMS 1.1 are translated to scale denominators as used in WMS 1.3.0 using the "OGC standard pixel size".

Note that the scale hints provided in the test fixture for WMS 1.1.1 were apparently not calculated using the OGC standard pixel size (my guess is around ~72dpi was used), so that I have recalculated them. Due to floating-point precision issues the test for WMS 1.1.1 also requires comparing rounded values.

WMS 1.1.1 ScaleHint is converted to scale denominators as used
in WMS 1.3.0 capabilities documents for consistency.

Note that the test using WMS 1.1.1 currently fails due to a
significant difference in the scale hints provided in the
1.1.1 and 1.3.0 test documents, presumably caused by a
non-standard pixel size being used to calculate the scale
hints for the 1.1.1 document (i.e. not exactly a square
0.28x0.28mm pixel as specified by the WMS 1.3.0 standard).
The StyleHint values were obviously calculated using a non-standard
pixel size - this changes them to be the values produced applying the
standard pixel size to the MinScaleDenom and MaxScaleDenom provided in
the WMS 1.3.0 capabilities document.
This avoids floating point precision problems caused by converting
ScaleHint to MinScaleDenominator and MaxScaleDenominator
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.

1 participant