Skip to content

Commit

Permalink
Add a hillshade layer
Browse files Browse the repository at this point in the history
  • Loading branch information
jleedev committed Sep 18, 2024
1 parent fef74b6 commit 6fb25d0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/js/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ export function build(tileURL, spriteURL, glyphURL, locales) {
url: tileURL,
type: "vector",
},
dem: {
attribution:
'<a target="_blank" rel="noopener" href="https://registry.opendata.aws/terrain-tiles/">Terrain Tiles</a>',
type: "raster-dem",
tiles: [
"https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",
],
encoding: "terrarium",
tileSize: 256,
// The actual maxzoom is 15
maxzoom: 12,
},
},
sprite: spriteURL,
light: {
Expand Down
19 changes: 19 additions & 0 deletions src/layer/hillshade.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const hillshading = {
id: "hillshading",
type: "hillshade",
source: "dem",
paint: {
"hillshade-exaggeration": [
"interpolate",
["linear"],
["zoom"],
3,
0.2,
12,
0.5,
],
"hillshade-shadow-color": "rgba(102,85,51,1)",
"hillshade-highlight-color": "rgba(255,255,204,1)",
"hillshade-accent-color": "rgba(0,0,0,1)",
},
};
3 changes: 3 additions & 0 deletions src/layer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as lyrBackground from "./background.js";
import * as lyrBoundary from "./boundary.js";
import * as lyrConstruction from "./construction.js";
import * as lyrHighwayShield from "./highway_shield.js";
import * as lyrHillshade from "./hillshade.js";
import * as lyrLanduse from "./landuse.js";
import * as lyrOneway from "./oneway.js";
import * as lyrPark from "./park.js";
Expand Down Expand Up @@ -83,6 +84,8 @@ export function build(locales) {

lyrFerry.ferry,

lyrHillshade.hillshading,

lyrAeroway.runway,
lyrAeroway.runwayArea,
lyrAeroway.taxiway,
Expand Down

0 comments on commit 6fb25d0

Please sign in to comment.