From c3877a0356f730ec9b94abffca9bc9b2bbe73c68 Mon Sep 17 00:00:00 2001 From: Oliver Wipfli Date: Sat, 21 May 2022 23:26:33 +0200 Subject: [PATCH 1/3] Turn on terrain 3d --- style/americana.js | 26 ++++++++++++-- style/package-lock.json | 79 +++++++++++++++++++++++++++++++++++++---- style/package.json | 2 +- 3 files changed, 97 insertions(+), 10 deletions(-) diff --git a/style/americana.js b/style/americana.js index c9f6312ab..f35ee099b 100644 --- a/style/americana.js +++ b/style/americana.js @@ -37,6 +37,13 @@ americanaLayers.push( lyrPark.fill, lyrAeroway.fill, lyrPark.parkFill, + { + id: "hills", + type: "hillshade", + source: "hillshadeSource", + layout: { visibility: "visible" }, + paint: { "hillshade-shadow-color": "#473B24" }, + }, lyrBoundary.countyCasing, lyrBoundary.stateCasing, @@ -301,11 +308,25 @@ var style = { name: "Americana", glyphs: "https://fonts.openmaptiles.org/{fontstack}/{range}.pbf", layers: americanaLayers, + terrain: { + source: "terrainSource", + exaggeration: 1, + }, sources: { openmaptiles: { url: config.OPENMAPTILES_URL, type: "vector", }, + terrainSource: { + type: "raster-dem", + url: "https://demotiles.maplibre.org/terrain-tiles/tiles.json", + tileSize: 256, + }, + hillshadeSource: { + type: "raster-dem", + url: "https://demotiles.maplibre.org/terrain-tiles/tiles.json", + tileSize: 256, + }, }, sprite: new URL("sprites/sprite", baseUrl).href, light: { @@ -321,8 +342,9 @@ var map = (window.map = new maplibregl.Map({ hash: true, antialias: true, style: style, - center: [-94, 40.5], // starting position [lng, lat] - zoom: 4, // starting zoom + zoom: 12, + center: [11.39085, 47.27574], + pitch: 52, attributionControl: false, })); diff --git a/style/package-lock.json b/style/package-lock.json index 3b1090cd8..43b0afbd8 100644 --- a/style/package-lock.json +++ b/style/package-lock.json @@ -11,7 +11,7 @@ "@beyondtracks/spritezero-cli": "^2.3.0" }, "devDependencies": { - "maplibre-gl": "^2.1.9", + "maplibre-gl": "^2.2.0-pre.2", "openmapsamples-maplibre": "github:adamfranco/OpenMapSamples-MapLibre", "parcel": "^2.3.0", "prettier": "2.3.2", @@ -2978,9 +2978,9 @@ } }, "node_modules/maplibre-gl": { - "version": "2.1.9", - "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.1.9.tgz", - "integrity": "sha512-pnWJmILeZpgA5QSI7K7xFK3yrkyYTd9srw3fCi2Ca52Phm78hsznPwUErEQcZLfxXKn/1h9t8IPdj0TH0NBNbg==", + "version": "2.2.0-pre.2", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.2.0-pre.2.tgz", + "integrity": "sha512-OYdiFUzLCBO/Kiteb9zRbnRN1qwWP2s4OdKLHHu3PaW/5SxE/kMthf7fWxygw5QEvx9DB4PKQ/TBx92y6VUsgA==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -3344,6 +3344,38 @@ "openmapsamples": "github:adamfranco/OpenMapSamples" } }, + "node_modules/openmapsamples-maplibre/node_modules/maplibre-gl": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.1.9.tgz", + "integrity": "sha512-pnWJmILeZpgA5QSI7K7xFK3yrkyYTd9srw3fCi2Ca52Phm78hsznPwUErEQcZLfxXKn/1h9t8IPdj0TH0NBNbg==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@mapbox/geojson-rewind": "^0.5.1", + "@mapbox/jsonlint-lines-primitives": "^2.0.2", + "@mapbox/mapbox-gl-supported": "^2.0.1", + "@mapbox/point-geometry": "^0.1.0", + "@mapbox/tiny-sdf": "^2.0.4", + "@mapbox/unitbezier": "^0.0.1", + "@mapbox/vector-tile": "^1.3.1", + "@mapbox/whoots-js": "^3.1.0", + "@types/geojson": "^7946.0.8", + "@types/mapbox__point-geometry": "^0.1.2", + "@types/mapbox__vector-tile": "^1.3.0", + "@types/pbf": "^3.0.2", + "csscolorparser": "~1.0.3", + "earcut": "^2.2.3", + "geojson-vt": "^3.2.1", + "gl-matrix": "^3.4.3", + "murmurhash-js": "^1.0.0", + "pbf": "^3.2.1", + "potpack": "^1.0.2", + "quickselect": "^2.0.0", + "supercluster": "^7.1.4", + "tinyqueue": "^2.0.3", + "vt-pbf": "^3.1.3" + } + }, "node_modules/ordered-binary": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/ordered-binary/-/ordered-binary-1.2.4.tgz", @@ -6570,9 +6602,9 @@ } }, "maplibre-gl": { - "version": "2.1.9", - "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.1.9.tgz", - "integrity": "sha512-pnWJmILeZpgA5QSI7K7xFK3yrkyYTd9srw3fCi2Ca52Phm78hsznPwUErEQcZLfxXKn/1h9t8IPdj0TH0NBNbg==", + "version": "2.2.0-pre.2", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.2.0-pre.2.tgz", + "integrity": "sha512-OYdiFUzLCBO/Kiteb9zRbnRN1qwWP2s4OdKLHHu3PaW/5SxE/kMthf7fWxygw5QEvx9DB4PKQ/TBx92y6VUsgA==", "dev": true, "requires": { "@mapbox/geojson-rewind": "^0.5.1", @@ -6843,6 +6875,39 @@ "requires": { "maplibre-gl": "^2.0", "openmapsamples": "github:adamfranco/OpenMapSamples" + }, + "dependencies": { + "maplibre-gl": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.1.9.tgz", + "integrity": "sha512-pnWJmILeZpgA5QSI7K7xFK3yrkyYTd9srw3fCi2Ca52Phm78hsznPwUErEQcZLfxXKn/1h9t8IPdj0TH0NBNbg==", + "dev": true, + "requires": { + "@mapbox/geojson-rewind": "^0.5.1", + "@mapbox/jsonlint-lines-primitives": "^2.0.2", + "@mapbox/mapbox-gl-supported": "^2.0.1", + "@mapbox/point-geometry": "^0.1.0", + "@mapbox/tiny-sdf": "^2.0.4", + "@mapbox/unitbezier": "^0.0.1", + "@mapbox/vector-tile": "^1.3.1", + "@mapbox/whoots-js": "^3.1.0", + "@types/geojson": "^7946.0.8", + "@types/mapbox__point-geometry": "^0.1.2", + "@types/mapbox__vector-tile": "^1.3.0", + "@types/pbf": "^3.0.2", + "csscolorparser": "~1.0.3", + "earcut": "^2.2.3", + "geojson-vt": "^3.2.1", + "gl-matrix": "^3.4.3", + "murmurhash-js": "^1.0.0", + "pbf": "^3.2.1", + "potpack": "^1.0.2", + "quickselect": "^2.0.0", + "supercluster": "^7.1.4", + "tinyqueue": "^2.0.3", + "vt-pbf": "^3.1.3" + } + } } }, "ordered-binary": { diff --git a/style/package.json b/style/package.json index 4e2ac5bdf..94b4a3b8f 100644 --- a/style/package.json +++ b/style/package.json @@ -22,7 +22,7 @@ "@beyondtracks/spritezero-cli": "^2.3.0" }, "devDependencies": { - "maplibre-gl": "^2.1.9", + "maplibre-gl": "^2.2.0-pre.2", "openmapsamples-maplibre": "github:adamfranco/OpenMapSamples-MapLibre", "parcel": "^2.3.0", "prettier": "2.3.2", From a0ce8f39b49e8cd6d755ff926759cecb649b3c5f Mon Sep 17 00:00:00 2001 From: Oliver Wipfli Date: Sat, 21 May 2022 23:55:09 +0200 Subject: [PATCH 2/3] Use global terrain tiles from @acalcutt --- style/americana.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/style/americana.js b/style/americana.js index f35ee099b..d869c0b67 100644 --- a/style/americana.js +++ b/style/americana.js @@ -319,12 +319,12 @@ var style = { }, terrainSource: { type: "raster-dem", - url: "https://demotiles.maplibre.org/terrain-tiles/tiles.json", + url: "https://tiles.wifidb.net/data/jaxa_terrainrgb.json", tileSize: 256, }, hillshadeSource: { type: "raster-dem", - url: "https://demotiles.maplibre.org/terrain-tiles/tiles.json", + url: "https://tiles.wifidb.net/data/jaxa_terrainrgb.json", tileSize: 256, }, }, From 2f4a40524305f27e8e10ab458903561800a59a13 Mon Sep 17 00:00:00 2001 From: Oliver Wipfli Date: Sun, 22 May 2022 00:00:28 +0200 Subject: [PATCH 3/3] Center on US --- style/americana.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/style/americana.js b/style/americana.js index d869c0b67..14f975f7e 100644 --- a/style/americana.js +++ b/style/americana.js @@ -342,9 +342,8 @@ var map = (window.map = new maplibregl.Map({ hash: true, antialias: true, style: style, - zoom: 12, - center: [11.39085, 47.27574], - pitch: 52, + center: [-94, 40.5], // starting position [lng, lat] + zoom: 4, // starting zoom attributionControl: false, }));