Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layers: update Maptiler outdoor-v2 #444

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/components/Map/behaviour/featureHover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ export const addHoverPaint = (origStyle) => {
const iconOpacity = ['case', ['boolean', ['feature-state', 'hideIcon'], false], 0, hoverExpr]; // prettier-ignore

origStyle.layers
.filter((layer) => layer.id.match(/^poi-/))
.filter(
(layer) =>
layer['source-layer'] === 'poi' ||
layer['source-layer'] === 'outdoor_poi',
)
.forEach((layer) => {
if (layer.paint) {
// TODO for outdoor style they use it for hiding icons by zoom layer id:'Outdoor'
layer.paint['icon-opacity'] = iconOpacity; // eslint-disable-line no-param-reassign
layer.paint['text-opacity'] = iconOpacity; // eslint-disable-line no-param-reassign
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/Map/behaviour/useToggleTerrainControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import maplibregl from 'maplibre-gl';
import { createMapEventHook } from '../../helpers';

const TERRAIN = {
source: 'terrain',
source: 'terrain-rgb',
exaggeration: 1,
};

Expand Down
12 changes: 8 additions & 4 deletions src/components/Map/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export const OSMAPP_SPRITE = [
id: 'default',
url: `${window.location.protocol}//${window.location.host}/sprites/osmapp`,
},
{
id: 'outdoorSprite',
url: `https://api.maptiler.com/maps/outdoor-v2/sprite?key=${apiKey}`,
},
];

export const GLYPHS = `https://api.maptiler.com/fonts/{fontstack}/{range}.pbf?key=${apiKey}`;
Expand All @@ -29,12 +33,12 @@ export const OSMAPP_SOURCES: Record<string, SourceSpecification> = {
},
contours: {
type: 'vector' as const,
url: `https://api.maptiler.com/tiles/contours/tiles.json?key=${apiKey}`,
url: `https://api.maptiler.com/tiles/contours-v2/tiles.json?key=${apiKey}`,
},
terrain: {
url: `https://api.maptiler.com/tiles/terrain-rgb/tiles.json?key=${apiKey}`,
'terrain-rgb': {
url: `https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json?key=${apiKey}`,
type: 'raster-dem' as const,
tileSize: 256,
// tileSize: 256,
},
outdoor: {
url: `https://api.maptiler.com/tiles/outdoor/tiles.json?key=${apiKey}`,
Expand Down
9 changes: 7 additions & 2 deletions src/components/Map/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { isBrowser } from '../helpers';
import { getGlobalMap } from '../../services/mapStorage';

const isOsmLayer = (id) => {

Check failure on line 5 in src/components/Map/helpers.ts

View workflow job for this annotation

GitHub Actions / lint-test

'isOsmLayer' is assigned a value but never used
if (id.startsWith('place-country-')) return false; // https://github.com/zbycz/osmapp/issues/35
if (id === 'place-continent') return false;
if (id === 'water-name-ocean') return false;
Expand All @@ -12,8 +12,13 @@

export const layersWithOsmId = (style) =>
style.layers // TODO make it custom for basic/outdoor + revert place_
.map((x) => x.id)
.filter((id) => isOsmLayer(id));
.filter(
(layer) =>
layer['source-layer'] === 'poi' ||
layer['source-layer'] === 'outdoor_poi',
)
.map((x) => x.id);
// .filter((id) => isOsmLayer(id));

export const getIsOsmObject = ({ id, layer }) => {
// these layers with id <= ~10000 are broken
Expand Down
Loading
Loading