Skip to content

Commit

Permalink
Use point resolution for hillshade calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Mar 29, 2024
1 parent a547aa2 commit 148d56c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/apply.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ import {
import {
equivalent,
fromLonLat,
getPointResolution,
get as getProjection,
getUserProjection,
} from 'ol/proj.js';
import {getCenter, getTopLeft} from 'ol/extent.js';
import {getFonts} from './text.js';
import {getTopLeft} from 'ol/extent.js';
import {hillshade} from './shaders.js';
import {
normalizeSourceUrl,
Expand Down Expand Up @@ -907,9 +908,16 @@ export function setupLayer(glStyle, styleUrl, glLayer, options) {
} else if (glSource.type == 'raster-dem' && glLayer.type == 'hillshade') {
const hillshadeLayer = setupHillshadeLayer(glSource, styleUrl, options);
layer = hillshadeLayer;
hillshadeLayer.getSource().on('beforeoperations', function (event) {
const source = hillshadeLayer.getSource();
source.on('beforeoperations', function (event) {
const data = event.data;
data.resolution = event.resolution;
data.resolution = getPointResolution(
options.projection || 'EPSG:3857',
event.resolution,
getCenter(event.extent),
'm',
);
console.log(options);

Check failure on line 920 in src/apply.js

View workflow job for this annotation

GitHub Actions / test

Unexpected console statement
const zoom = getZoomForResolution(
event.resolution,
options.resolutions || defaultResolutions,
Expand Down

0 comments on commit 148d56c

Please sign in to comment.