diff --git a/src/ol/proj.js b/src/ol/proj.js index f933af175f..89c0d74333 100644 --- a/src/ol/proj.js +++ b/src/ol/proj.js @@ -188,6 +188,12 @@ export function getPointResolution(projection, resolution, point, opt_units) { const getter = projection.getPointResolutionFunc(); if (getter) { pointResolution = getter(resolution, point); + if (opt_units && opt_units !== projection.getUnits()) { + const metersPerUnit = projection.getMetersPerUnit(); + if (metersPerUnit) { + pointResolution = pointResolution * metersPerUnit / METERS_PER_UNIT[opt_units]; + } + } } else { const units = projection.getUnits(); if (units == Units.DEGREES && !opt_units || opt_units == Units.DEGREES) { diff --git a/src/ol/proj/Projection.js b/src/ol/proj/Projection.js index ce4b2cb305..8c4f0d7ac7 100644 --- a/src/ol/proj/Projection.js +++ b/src/ol/proj/Projection.js @@ -19,7 +19,7 @@ import {METERS_PER_UNIT} from './Units.js'; * @property {function(number, import("../coordinate.js").Coordinate):number} [getPointResolution] * Function to determine resolution at a point. The function is called with a * `{number}` view resolution and an `{import("../coordinate.js").Coordinate}` as arguments, and returns - * the `{number}` resolution at the passed coordinate. If this is `undefined`, + * the `{number}` resolution in projection units at the passed coordinate. If this is `undefined`, * the default {@link module:ol/proj#getPointResolution} function will be used. */