Include mpu in point resolution calculations

This commit is contained in:
mike-000
2022-03-22 14:44:57 +00:00
parent 7f12698a91
commit c926980339

View File

@@ -43,18 +43,13 @@ function onChangeProjection() {
const currentCenter = currentView.getCenter(); const currentCenter = currentView.getCenter();
const currentRotation = currentView.getRotation(); const currentRotation = currentView.getRotation();
const newCenter = transform(currentCenter, currentProjection, newProjection); const newCenter = transform(currentCenter, currentProjection, newProjection);
const currentPointResolution = getPointResolution( const currentMPU = currentProjection.getMetersPerUnit();
currentProjection, const newMPU = newProjection.getMetersPerUnit();
1, const currentPointResolution =
currentCenter, getPointResolution(currentProjection, 1 / currentMPU, currentCenter, 'm') *
'm' currentMPU;
); const newPointResolution =
const newPointResolution = getPointResolution( getPointResolution(newProjection, 1 / newMPU, newCenter, 'm') * newMPU;
newProjection,
1,
newCenter,
'm'
);
const newResolution = const newResolution =
(currentResolution * currentPointResolution) / newPointResolution; (currentResolution * currentPointResolution) / newPointResolution;
const newView = new View({ const newView = new View({