getPointResolution returns proj units
This commit is contained in:
@@ -188,6 +188,12 @@ export function getPointResolution(projection, resolution, point, opt_units) {
|
|||||||
const getter = projection.getPointResolutionFunc();
|
const getter = projection.getPointResolutionFunc();
|
||||||
if (getter) {
|
if (getter) {
|
||||||
pointResolution = getter(resolution, point);
|
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 {
|
} else {
|
||||||
const units = projection.getUnits();
|
const units = projection.getUnits();
|
||||||
if (units == Units.DEGREES && !opt_units || opt_units == Units.DEGREES) {
|
if (units == Units.DEGREES && !opt_units || opt_units == Units.DEGREES) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import {METERS_PER_UNIT} from './Units.js';
|
|||||||
* @property {function(number, import("../coordinate.js").Coordinate):number} [getPointResolution]
|
* @property {function(number, import("../coordinate.js").Coordinate):number} [getPointResolution]
|
||||||
* Function to determine resolution at a point. The function is called with a
|
* 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
|
* `{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.
|
* the default {@link module:ol/proj#getPointResolution} function will be used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user