Skip to content

Commit

Permalink
layers: hide gardens without name (#104)
Browse files Browse the repository at this point in the history
* Use poiLayers in basicStyle

* Render only gardens with name
  • Loading branch information
kudlav authored Jul 25, 2022
1 parent 8125f51 commit bcb1fee
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 120 deletions.
121 changes: 2 additions & 119 deletions src/components/Map/styles/basicStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
buildings3dBase,
buildings3dExtrusion,
} from './layers/buildings3dLayers';
import { poiLayers } from './layers/poiLayers';
import { addHoverPaint } from '../behaviour/featureHover';
import { BACKGROUND, GLYPHS, OSMAPP_SOURCES, OSMAPP_SPRITE } from '../consts';
import { motorwayConstruction } from './layers/contruction';
Expand Down Expand Up @@ -2243,125 +2244,6 @@ export const basicStyle = addHoverPaint({
'text-halo-color': 'rgba(255,255,255,0.7)',
},
},
{
id: 'poi-level-3',
type: 'symbol',
source: 'maptiler_planet',
'source-layer': 'poi',
minzoom: 16,
filter: ['all', ['==', '$type', 'Point'], ['>=', 'rank', 25]],
layout: {
'text-padding': 2,
'text-font': ['Noto Sans Regular'],
'text-anchor': 'top',
'icon-image': '{class}_11',
'text-field': '{name:latin}\n{name:nonlatin}',
'text-offset': [0, 0.6],
'text-size': 12,
'text-max-width': 9,
},
paint: {
'text-halo-blur': 0.5,
'text-color': '#666',
'text-halo-width': 1,
'text-halo-color': '#ffffff',
},
},
{
id: 'poi-level-2',
type: 'symbol',
source: 'maptiler_planet',
'source-layer': 'poi',
minzoom: 15,
filter: [
'all',
['==', '$type', 'Point'],
['<=', 'rank', 24],
['>=', 'rank', 15],
],
layout: {
'text-padding': 2,
'text-font': ['Noto Sans Regular'],
'text-anchor': 'top',
'icon-image': '{class}_11',
'text-field': '{name:latin}\n{name:nonlatin}',
'text-offset': [0, 0.6],
'text-size': 12,
'text-max-width': 9,
},
paint: {
'text-halo-blur': 0.5,
'text-color': '#666',
'text-halo-width': 1,
'text-halo-color': '#ffffff',
},
},
{
id: 'poi-level-1',
type: 'symbol',
source: 'maptiler_planet',
'source-layer': 'poi',
minzoom: 14,
filter: [
'all',
['==', '$type', 'Point'],
['<=', 'rank', 14],
['has', 'name'],
],
layout: {
'text-padding': 2,
'text-font': ['Noto Sans Regular'],
'text-anchor': 'top',
'icon-image': '{class}_11',
'text-field': '{name:latin}\n{name:nonlatin}',
'text-offset': [0, 0.6],
'text-size': 12,
'text-max-width': 9,
},
paint: {
'text-halo-blur': 0.5,
'text-color': '#666',
'text-halo-width': 1,
'text-halo-color': '#ffffff',
},
},
{
id: 'poi-railway',
type: 'symbol',
source: 'maptiler_planet',
'source-layer': 'poi',
minzoom: 13,
maxzoom: 24,
filter: [
'all',
['==', '$type', 'Point'],
['has', 'name'],
['==', 'class', 'railway'],
['==', 'subclass', 'station'],
],
layout: {
'text-padding': 2,
'text-font': ['Noto Sans Regular'],
'text-anchor': 'top',
'icon-image': '{class}_11',
'text-field': '{name:latin}\n{name:nonlatin}',
'text-offset': [0, 0.6],
'text-size': 12,
'text-max-width': 9,
'icon-optional': false,
'icon-ignore-placement': false,
'icon-allow-overlap': false,
'text-ignore-placement': false,
'text-allow-overlap': false,
'text-optional': true,
},
paint: {
'text-halo-blur': 0.5,
'text-color': '#666',
'text-halo-width': 1,
'text-halo-color': '#ffffff',
},
},
{
id: 'highway-name-path',
type: 'symbol',
Expand Down Expand Up @@ -2884,6 +2766,7 @@ export const basicStyle = addHoverPaint({
'text-halo-color': 'rgba(255,255,255,0.8)',
},
},
...poiLayers,
],
id: 'ciw6czz2n00242kmg6hw20box',
});
31 changes: 30 additions & 1 deletion src/components/Map/styles/layers/poiLayers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,36 @@ export const poiLayers = [
source: 'maptiler_planet',
'source-layer': 'poi',
minzoom: 16,
filter: ['all', ['==', '$type', 'Point'], ['>=', 'rank', 25]],
filter: [
'all',
['==', '$type', 'Point'],
['>=', 'rank', 25],
['!=', 'subclass', 'garden'],
],
layout: {
'text-padding': 2,
'text-font': ['Noto Sans Regular'],
'text-anchor': 'top',
'icon-image': '{class}_11',
'text-field': '{name:latin}\n{name:nonlatin}',
'text-offset': [0, 0.6],
'text-size': 12,
'text-max-width': 9,
},
paint: {
'text-halo-blur': 0.5,
'text-color': '#666',
'text-halo-width': 1,
'text-halo-color': '#ffffff',
},
},
{
id: 'poi-level-3-gardens',
type: 'symbol',
source: 'maptiler_planet',
'source-layer': 'poi',
minzoom: 16,
filter: ['all', ['==', 'subclass', 'garden'], ['has', 'name']],
layout: {
'text-padding': 2,
'text-font': ['Noto Sans Regular'],
Expand Down

1 comment on commit bcb1fee

@vercel
Copy link

@vercel vercel bot commented on bcb1fee Jul 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

osmapp – ./

osmapp.vercel.app
osmapp.org
osmapp-zbycz.vercel.app
osmapp-git-master-zbycz.vercel.app

Please sign in to comment.