This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch 580-layer-ordering
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git

commit fd4d0eda0b1356157ff792cc81ca4fa783ab2f3b
Author: Bertil Chapuis <[email protected]>
AuthorDate: Tue Feb 7 09:52:40 2023 +0100

    Add helper to add sort keys to directives
---
 basemap/layers/amenity/background.js      |   72 +-
 basemap/layers/amenity/fountain.js        |   18 +-
 basemap/layers/boundary/line.js           |   40 +-
 basemap/layers/highway/bridge_line.js     |  186 ++--
 basemap/layers/highway/bridge_outline.js  |  186 ++--
 basemap/layers/highway/highway_dash.js    |  132 +--
 basemap/layers/highway/highway_line.js    |  179 ++-
 basemap/layers/highway/highway_outline.js |  205 ++--
 basemap/layers/highway/tunnel_line.js     |  188 ++--
 basemap/layers/highway/tunnel_outline.js  |  186 ++--
 basemap/layers/landuse/background.js      |  210 ++--
 basemap/layers/landuse/overlay.js         |   40 +-
 basemap/layers/leisure/background.js      |  129 ++-
 basemap/layers/leisure/nature_reserve.js  |   18 +-
 basemap/layers/leisure/overlay.js         |   18 +-
 basemap/layers/man_made/bridge.js         |   16 +-
 basemap/layers/natural/background.js      |   72 +-
 basemap/layers/natural/overlay.js         |   42 +-
 basemap/layers/ocean/background.js        |   18 +-
 basemap/layers/point/icon.js              | 1736 ++++++++++++++---------------
 basemap/layers/railway/line.js            |  152 +--
 basemap/layers/route/style.js             |   18 +-
 basemap/utils/utils.js                    |   13 +
 23 files changed, 1949 insertions(+), 1925 deletions(-)

diff --git a/basemap/layers/amenity/background.js 
b/basemap/layers/amenity/background.js
index dff90bea..fe3bdf7d 100644
--- a/basemap/layers/amenity/background.js
+++ b/basemap/layers/amenity/background.js
@@ -1,3 +1,40 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'amenity'], 'kindergarten'],
+        'fill-color': 'rgb(255, 255, 228)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'school'],
+        'fill-color': 'rgb(255, 255, 228)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'college'],
+        'fill-color': 'rgb(255, 255, 228)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'university'],
+        'fill-color': 'rgb(255, 255, 228)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'hospital'],
+        'fill-color': 'rgb(255, 255, 228)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'grave_yard'],
+        'fill-color': 'rgb(170, 203, 175)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'parking'],
+        'fill-color': 'rgb(238, 238, 238)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'motorcycle_parking'],
+        'fill-color': 'rgb(238, 238, 238)',
+    },
+];
+
 export default {
     id: 'amenity_fill_1',
     type: 'fill',
@@ -9,38 +46,5 @@ export default {
     paint: {
         'fill-antialias': true,
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'amenity'], 'kindergarten'],
-            'fill-color': 'rgb(255, 255, 228)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'school'],
-            'fill-color': 'rgb(255, 255, 228)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'college'],
-            'fill-color': 'rgb(255, 255, 228)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'university'],
-            'fill-color': 'rgb(255, 255, 228)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'hospital'],
-            'fill-color': 'rgb(255, 255, 228)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'grave_yard'],
-            'fill-color': 'rgb(170, 203, 175)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'parking'],
-            'fill-color': 'rgb(238, 238, 238)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'motorcycle_parking'],
-            'fill-color': 'rgb(238, 238, 238)',
-        },
-    ],
+    directives: directives.map(withFillSortKey),
 }
diff --git a/basemap/layers/amenity/fountain.js 
b/basemap/layers/amenity/fountain.js
index 037667ad..fdb839ea 100644
--- a/basemap/layers/amenity/fountain.js
+++ b/basemap/layers/amenity/fountain.js
@@ -1,3 +1,13 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'amenity'], 'fountain'],
+        'fill-color': 'rgb(170, 211, 223)',
+        'fill-outline-color': 'rgb(170, 211, 223)',
+    },
+];
+
 export default {
     id: 'amenity_fill_2',
     type: 'fill',
@@ -9,11 +19,5 @@ export default {
     paint: {
         'fill-antialias': true,
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'amenity'], 'fountain'],
-            'fill-color': 'rgb(170, 211, 223)',
-            'fill-outline-color': 'rgb(170, 211, 223)',
-        },
-    ],
+    directives: directives.map(withFillSortKey),
 }
diff --git a/basemap/layers/boundary/line.js b/basemap/layers/boundary/line.js
index a5c7c477..8fb9ac83 100644
--- a/basemap/layers/boundary/line.js
+++ b/basemap/layers/boundary/line.js
@@ -1,3 +1,24 @@
+import {withLineSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'admin_level'], "1"],
+        'line-color': 'rgb(207, 155, 203)',
+    },
+    {
+        filter: ['==', ['get', 'admin_level'], "2"],
+        'line-color': 'rgb(207, 155, 203)',
+    },
+    {
+        filter: ['==', ['get', 'admin_level'], "3"],
+        'line-color': 'rgb(207, 155, 203)',
+    },
+    {
+        filter: ['==', ['get', 'admin_level'], "4"],
+        'line-color': 'rgb(207, 155, 203)',
+    },
+];
+
 export default {
     id: 'boundary',
     type: 'line',
@@ -9,23 +30,6 @@ export default {
     paint: {
         'line-dasharray': [4, 1, 1, 1],
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'admin_level'], "1"],
-            'line-color': 'rgb(207, 155, 203)',
-        },
-        {
-            filter: ['==', ['get', 'admin_level'], "2"],
-            'line-color': 'rgb(207, 155, 203)',
-        },
-        {
-            filter: ['==', ['get', 'admin_level'], "3"],
-            'line-color': 'rgb(207, 155, 203)',
-        },
-        {
-            filter: ['==', ['get', 'admin_level'], "4"],
-            'line-color': 'rgb(207, 155, 203)',
-        },
-    ],
+    directives: directives.map(withLineSortKey),
 
 }
diff --git a/basemap/layers/highway/bridge_line.js 
b/basemap/layers/highway/bridge_line.js
index 431105b0..c9e3674a 100644
--- a/basemap/layers/highway/bridge_line.js
+++ b/basemap/layers/highway/bridge_line.js
@@ -1,3 +1,92 @@
+import {withLineSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'motorway'],
+            ['==', ['get', 'highway'], 'motorway_link'],
+        ],
+        'line-color': 'rgb(227, 113, 134)',
+        'road-width': 12,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'trunk'],
+            ['==', ['get', 'highway'], 'trunk_link'],
+        ],
+        'line-color': 'rgb(248, 163, 132)',
+        'road-width': 8,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'primary'],
+            ['==', ['get', 'highway'], 'primary_link'],
+        ],
+        'line-color': 'rgb(252, 202, 137)',
+        'road-width': 10,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'secondary'],
+            ['==', ['get', 'highway'], 'secondary_link'],
+        ],
+        'line-color': 'rgb(243, 246, 161)',
+        'road-width': 8,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'tertiary'],
+            ['==', ['get', 'highway'], 'tertiary_link'],
+        ],
+        'line-color': 'rgb(229, 229, 229)',
+        'road-width': 8,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'unclassified'],
+        'line-color': 'rgb(229, 229, 229)',
+        'road-width': 4,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'residential'],
+        'line-color': 'rgb(229, 229, 229)',
+        'road-width': 4,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'living_street'],
+        'line-color': 'rgb(213, 213, 213)',
+        'road-width': 4,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'service'],
+        'line-color': 'rgb(229, 229, 229)',
+        'road-width': 4,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'track'],
+        'line-color': 'rgb(159, 126, 57)',
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'all',
+            ['==', ['get', 'highway'], 'pedestrian'],
+            ['!=', ['get', '$type'], 'Polygon'],
+        ],
+        'line-color': 'rgb(194, 194, 212)',
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'raceway'],
+        'line-color': 'rgb(255, 147, 166)',
+        'road-width': 2,
+    },
+]
+
 export default {
     id: 'bridge_line',
     source: 'baremaps',
@@ -9,100 +98,5 @@ export default {
         'line-join': 'miter',
     },
     filter: ['any', ['==', ['get', 'bridge'], 'yes']],
-    directives: [
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'motorway'],
-                ['==', ['get', 'highway'], 'motorway_link'],
-            ],
-            'line-color': 'rgb(227, 113, 134)',
-            'road-width': 12,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'trunk'],
-                ['==', ['get', 'highway'], 'trunk_link'],
-            ],
-            'line-color': 'rgb(248, 163, 132)',
-            'road-width': 8,
-            'line-sort-key': 9,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'primary'],
-                ['==', ['get', 'highway'], 'primary_link'],
-            ],
-            'line-color': 'rgb(252, 202, 137)',
-            'road-width': 10,
-            'line-sort-key': 8,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'secondary'],
-                ['==', ['get', 'highway'], 'secondary_link'],
-            ],
-            'line-color': 'rgb(243, 246, 161)',
-            'road-width': 8,
-            'line-sort-key': 7,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'tertiary'],
-                ['==', ['get', 'highway'], 'tertiary_link'],
-            ],
-            'line-color': 'rgb(229, 229, 229)',
-            'road-width': 8,
-            'line-sort-key': 6,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'unclassified'],
-            'line-color': 'rgb(229, 229, 229)',
-            'road-width': 4,
-            'line-sort-key': 5,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'residential'],
-            'line-color': 'rgb(229, 229, 229)',
-            'road-width': 4,
-            'line-sort-key': 4,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'living_street'],
-            'line-color': 'rgb(213, 213, 213)',
-            'road-width': 4,
-            'line-sort-key': 3,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'service'],
-            'line-color': 'rgb(229, 229, 229)',
-            'road-width': 4,
-            'line-sort-key': 2,
-        },
-        {
-            filter: [
-                'all',
-                ['==', ['get', 'highway'], 'pedestrian'],
-                ['!=', ['get', '$type'], 'Polygon'],
-            ],
-            'line-color': 'rgb(194, 194, 212)',
-            'road-width': 2,
-            'line-sort-key': 1,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'raceway'],
-            'line-color': 'rgb(255, 147, 166)',
-            'road-width': 2,
-            'line-sort-key': 1,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'track'],
-            'line-color': 'rgb(159, 126, 57)',
-            'road-width': 2,
-        },
-    ],
+    directives: directives.map(withLineSortKey),
 }
diff --git a/basemap/layers/highway/bridge_outline.js 
b/basemap/layers/highway/bridge_outline.js
index 866be43b..7fefb147 100644
--- a/basemap/layers/highway/bridge_outline.js
+++ b/basemap/layers/highway/bridge_outline.js
@@ -1,3 +1,92 @@
+import {withLineSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'motorway'],
+            ['==', ['get', 'highway'], 'motorway_link'],
+        ],
+        'line-color': 'rgb(223, 55, 106)',
+        'road-gap-width': 12,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'trunk'],
+            ['==', ['get', 'highway'], 'trunk_link'],
+        ],
+        'line-color': 'rgb(212, 91, 54)',
+        'road-gap-width': 8,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'primary'],
+            ['==', ['get', 'highway'], 'primary_link'],
+        ],
+        'line-color': 'rgb(173, 132, 56)',
+        'road-gap-width': 10,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'secondary'],
+            ['==', ['get', 'highway'], 'secondary_link'],
+        ],
+        'line-color': 'rgb(139, 149, 60)',
+        'road-gap-width': 8,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'tertiary'],
+            ['==', ['get', 'highway'], 'tertiary_link'],
+        ],
+        'line-color': 'rgb(171, 170, 169)',
+        'road-gap-width': 8,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'unclassified'],
+        'line-color': 'rgb(191, 185, 184)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'residential'],
+        'line-color': 'rgb(191, 185, 184)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'living_street'],
+        'line-color': 'rgb(186, 186, 186)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'service'],
+        'line-color': 'rgb(192, 189, 189)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'all',
+            ['==', ['get', 'highway'], 'pedestrian'],
+            ['!=', ['get', '$type'], 'Polygon'],
+        ],
+        'line-color': 'rgb(166, 165, 163)',
+        'road-gap-width': 2,
+        'road-width': 2,
+    },
+];
+
 export default {
     id: 'bridge_outline',
     source: 'baremaps',
@@ -9,100 +98,5 @@ export default {
         'line-join': 'miter',
     },
     filter: ['any', ['==', ['get', 'bridge'], 'yes']],
-    directives: [
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'motorway'],
-                ['==', ['get', 'highway'], 'motorway_link'],
-            ],
-            'line-color': 'rgb(223, 55, 106)',
-            'road-gap-width': 12,
-            'road-width': 2,
-            'line-sort-key': 10,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'trunk'],
-                ['==', ['get', 'highway'], 'trunk_link'],
-            ],
-            'line-color': 'rgb(212, 91, 54)',
-            'road-gap-width': 8,
-            'road-width': 2,
-            'line-sort-key': 9,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'primary'],
-                ['==', ['get', 'highway'], 'primary_link'],
-            ],
-            'line-color': 'rgb(173, 132, 56)',
-            'road-gap-width': 10,
-            'road-width': 2,
-            'line-sort-key': 8,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'secondary'],
-                ['==', ['get', 'highway'], 'secondary_link'],
-            ],
-            'line-color': 'rgb(139, 149, 60)',
-            'road-gap-width': 8,
-            'road-width': 2,
-            'line-sort-key': 7,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'tertiary'],
-                ['==', ['get', 'highway'], 'tertiary_link'],
-            ],
-            'line-color': 'rgb(171, 170, 169)',
-            'road-gap-width': 8,
-            'road-width': 2,
-            'line-sort-key': 6,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'unclassified'],
-            'line-color': 'rgb(191, 185, 184)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 5,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'residential'],
-            'line-color': 'rgb(191, 185, 184)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 4,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'living_street'],
-            'line-color': 'rgb(186, 186, 186)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 3,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'service'],
-            'line-color': 'rgb(192, 189, 189)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 2,
-        },
-        {
-            filter: [
-                'all',
-                ['==', ['get', 'highway'], 'pedestrian'],
-                ['!=', ['get', '$type'], 'Polygon'],
-            ],
-            'line-color': 'rgb(166, 165, 163)',
-            'road-gap-width': 2,
-            'road-width': 2,
-            'line-sort-key': 1,
-        },
-    ],
+    directives: directives.map(withLineSortKey),
 }
diff --git a/basemap/layers/highway/highway_dash.js 
b/basemap/layers/highway/highway_dash.js
index 535b9a13..3ca4eda7 100644
--- a/basemap/layers/highway/highway_dash.js
+++ b/basemap/layers/highway/highway_dash.js
@@ -1,3 +1,70 @@
+import {withLineSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'highway'], 'bridleway'],
+        'line-color': 'rgb(68, 159, 66)',
+        'road-width': 1,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'cycleway'],
+            [
+                'all',
+                ['==', ['get', 'highway'], 'path'],
+                ['==', ['get', 'bicycle'], 'designated'],
+            ],
+        ],
+        'line-color': 'rgba(28, 27, 254, 1)',
+        'road-width': 1,
+    },
+    {
+        filter: [
+            'any',
+            [
+                'all',
+                ['==', ['get', 'highway'], 'footway'],
+                ['==', ['get', 'access'], 'private'],
+            ],
+            [
+                'all',
+                ['==', ['get', 'highway'], 'service'],
+                ['in', ['get', 'access'], ['literal', ['private', 'no']]],
+            ],
+        ],
+        'line-color': 'rgb(192, 192, 192)',
+        'road-width': 1,
+    },
+    {
+        filter: [
+            'any',
+            [
+                'in',
+                ['get', 'highway'],
+                ['literal', ['sidewalk', 'crossing', 'steps']],
+            ],
+            [
+                'all',
+                ['==', ['get', 'highway'], 'footway'],
+                ['!=', ['get', 'access'], 'private'],
+            ],
+            [
+                'all',
+                ['==', ['get', 'highway'], 'path'],
+                ['!=', ['get', 'bicycle'], 'designated'],
+            ],
+        ],
+        'line-color': 'rgb(250, 132, 117)',
+        'road-width': 1,
+    },
+    {
+        filter: ['all', ['==', ['get', 'highway'], 'track']],
+        'line-color': 'rgb(177, 140, 63)',
+        'road-width': 1,
+    },
+];
+
 export default {
     id: 'highway_dash',
     type: 'line',
@@ -11,68 +78,5 @@ export default {
     paint: {
         'line-dasharray': [2, 2],
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'highway'], 'bridleway'],
-            'line-color': 'rgb(68, 159, 66)',
-            'road-width': 1,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'cycleway'],
-                [
-                    'all',
-                    ['==', ['get', 'highway'], 'path'],
-                    ['==', ['get', 'bicycle'], 'designated'],
-                ],
-            ],
-            'line-color': 'rgba(28, 27, 254, 1)',
-            'road-width': 1,
-        },
-        {
-            filter: [
-                'any',
-                [
-                    'all',
-                    ['==', ['get', 'highway'], 'footway'],
-                    ['==', ['get', 'access'], 'private'],
-                ],
-                [
-                    'all',
-                    ['==', ['get', 'highway'], 'service'],
-                    ['in', ['get', 'access'], ['literal', ['private', 'no']]],
-                ],
-            ],
-            'line-color': 'rgb(192, 192, 192)',
-            'road-width': 1,
-        },
-        {
-            filter: [
-                'any',
-                [
-                    'in',
-                    ['get', 'highway'],
-                    ['literal', ['sidewalk', 'crossing', 'steps']],
-                ],
-                [
-                    'all',
-                    ['==', ['get', 'highway'], 'footway'],
-                    ['!=', ['get', 'access'], 'private'],
-                ],
-                [
-                    'all',
-                    ['==', ['get', 'highway'], 'path'],
-                    ['!=', ['get', 'bicycle'], 'designated'],
-                ],
-            ],
-            'line-color': 'rgb(250, 132, 117)',
-            'road-width': 1,
-        },
-        {
-            filter: ['all', ['==', ['get', 'highway'], 'track']],
-            'line-color': 'rgb(177, 140, 63)',
-            'road-width': 1,
-        },
-    ],
+    directives: directives.map(withLineSortKey),
 }
diff --git a/basemap/layers/highway/highway_line.js 
b/basemap/layers/highway/highway_line.js
index e5af008d..acb43d8f 100644
--- a/basemap/layers/highway/highway_line.js
+++ b/basemap/layers/highway/highway_line.js
@@ -1,3 +1,88 @@
+import {withLineSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'motorway'],
+            ['==', ['get', 'highway'], 'motorway_link'],
+        ],
+        'line-color': 'rgb(233, 144, 161)',
+        'road-width': 12,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'trunk'],
+            ['==', ['get', 'highway'], 'trunk_link'],
+        ],
+        'line-color': 'rgb(250, 193, 172)',
+        'road-width': 8,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'primary'],
+            ['==', ['get', 'highway'], 'primary_link'],
+        ],
+        'line-color': 'rgb(253, 221, 179)',
+        'road-width': 10,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'secondary'],
+            ['==', ['get', 'highway'], 'secondary_link'],
+        ],
+        'line-color': 'rgb(248, 250, 202)',
+        'road-width': 8,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'tertiary'],
+            ['==', ['get', 'highway'], 'tertiary_link'],
+        ],
+        'line-color': 'rgb(254, 254, 254)',
+        'road-width': 8,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'unclassified'],
+        'line-color': 'rgb(254, 254, 254)',
+        'road-width': 4,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'residential'],
+        'line-color': 'rgb(254, 254, 254)',
+        'road-width': 4,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'living_street'],
+        'line-color': 'rgb(237, 237, 237)',
+        'road-width': 4,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'service'],
+        'line-color': 'rgb(254, 254, 254)',
+        'road-width': 4,
+    },
+    {
+        filter: [
+            'all',
+            ['==', ['get', 'highway'], 'pedestrian'],
+            ['!=', ['get', 'area'], 'yes'],
+        ],
+        'line-color': 'rgb(221, 221, 231)',
+        'road-width': 2,
+
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'raceway'],
+        'line-color': 'rgb(255, 192, 203)',
+        'road-width': 2,
+    },
+];
+
 export default {
     id: 'highway_line',
     source: 'baremaps',
@@ -15,97 +100,5 @@ export default {
         ['!=', ['get', 'layer'], '-1'],
         ['!=', ['get', 'covered'], 'yes'],
     ],
-    directives: [
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'motorway'],
-                ['==', ['get', 'highway'], 'motorway_link'],
-            ],
-            'line-color': 'rgb(233, 144, 161)',
-            'road-width': 12,
-            'line-sort-key': 10,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'trunk'],
-                ['==', ['get', 'highway'], 'trunk_link'],
-            ],
-            'line-color': 'rgb(250, 193, 172)',
-            'road-width': 8,
-            'line-sort-key': 9,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'primary'],
-                ['==', ['get', 'highway'], 'primary_link'],
-            ],
-            'line-color': 'rgb(253, 221, 179)',
-            'road-width': 10,
-            'line-sort-key': 8,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'secondary'],
-                ['==', ['get', 'highway'], 'secondary_link'],
-            ],
-            'line-color': 'rgb(248, 250, 202)',
-            'road-width': 8,
-            'line-sort-key': 7,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'tertiary'],
-                ['==', ['get', 'highway'], 'tertiary_link'],
-            ],
-            'line-color': 'rgb(254, 254, 254)',
-            'road-width': 8,
-            'line-sort-key': 6,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'unclassified'],
-            'line-color': 'rgb(254, 254, 254)',
-            'road-width': 4,
-            'line-sort-key': 5,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'residential'],
-            'line-color': 'rgb(254, 254, 254)',
-            'road-width': 4,
-            'line-sort-key': 4,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'living_street'],
-            'line-color': 'rgb(237, 237, 237)',
-            'road-width': 4,
-            'line-sort-key': 3,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'service'],
-            'line-color': 'rgb(254, 254, 254)',
-            'road-width': 4,
-            'line-sort-key': 2,
-        },
-        {
-            filter: [
-                'all',
-                ['==', ['get', 'highway'], 'pedestrian'],
-                ['!=', ['get', 'area'], 'yes'],
-            ],
-            'line-color': 'rgb(221, 221, 231)',
-            'road-width': 2,
-            'line-sort-key': 1,
-
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'raceway'],
-            'line-color': 'rgb(255, 192, 203)',
-            'road-width': 2,
-            'line-sort-key': 1,
-        },
-    ],
+    directives: directives.map(withLineSortKey),
 }
diff --git a/basemap/layers/highway/highway_outline.js 
b/basemap/layers/highway/highway_outline.js
index 7d3ba237..40c732e3 100644
--- a/basemap/layers/highway/highway_outline.js
+++ b/basemap/layers/highway/highway_outline.js
@@ -1,3 +1,101 @@
+import {withLineSortKey} from "../../utils/utils.js";
+
+let directives =[
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'motorway'],
+            ['==', ['get', 'highway'], 'motorway_link'],
+        ],
+        'line-color': 'rgb(227, 82, 126)',
+        'road-gap-width': 12,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'trunk'],
+            ['==', ['get', 'highway'], 'trunk_link'],
+        ],
+        'line-color': 'rgb(217, 111, 78)',
+        'road-gap-width': 8,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'primary'],
+            ['==', ['get', 'highway'], 'primary_link'],
+        ],
+        'line-color': 'rgb(192, 147, 62)',
+        'road-gap-width': 10,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'secondary'],
+            ['==', ['get', 'highway'], 'secondary_link'],
+        ],
+        'line-color': 'rgb(154, 166, 67)',
+        'road-gap-width': 8,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'tertiary'],
+            ['==', ['get', 'highway'], 'tertiary_link'],
+        ],
+        'line-color': 'rgb(190, 189, 188)',
+        'road-gap-width': 8,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'unclassified'],
+        'line-color': 'rgb(211, 207, 206)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'residential'],
+        'line-color': 'rgb(211, 207, 206)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'living_street'],
+        'line-color': 'rgb(207, 207, 207)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'service'],
+        'line-color': 'rgb(213, 211, 211)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'all',
+            ['==', ['get', 'highway'], 'pedestrian'],
+            ['!=', ['get', 'area'], 'yes'],
+        ],
+        'line-color': 'rgb(184, 183, 182)',
+        'road-gap-width': 2,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'all',
+            ['==', ['get', 'highway'], 'pedestrian'],
+            ['==', ['get', 'area'], 'yes'],
+        ],
+        'line-color': 'rgb(184, 183, 182)',
+        'road-width': 2,
+    },
+]
+
 export default {
     id: 'highway_outline',
     source: 'baremaps',
@@ -15,110 +113,5 @@ export default {
         ['!=', ['get', 'layer'], '-1'],
         ['!=', ['get', 'covered'], 'yes'],
     ],
-    directives: [
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'motorway'],
-                ['==', ['get', 'highway'], 'motorway_link'],
-            ],
-            'line-color': 'rgb(227, 82, 126)',
-            'road-gap-width': 12,
-            'road-width': 2,
-            'line-sort-key': 10,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'trunk'],
-                ['==', ['get', 'highway'], 'trunk_link'],
-            ],
-            'line-color': 'rgb(217, 111, 78)',
-            'road-gap-width': 8,
-            'road-width': 2,
-            'line-sort-key': 9,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'primary'],
-                ['==', ['get', 'highway'], 'primary_link'],
-            ],
-            'line-color': 'rgb(192, 147, 62)',
-            'road-gap-width': 10,
-            'road-width': 2,
-            'line-sort-key': 8,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'secondary'],
-                ['==', ['get', 'highway'], 'secondary_link'],
-            ],
-            'line-color': 'rgb(154, 166, 67)',
-            'road-gap-width': 8,
-            'road-width': 2,
-            'line-sort-key': 7,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'tertiary'],
-                ['==', ['get', 'highway'], 'tertiary_link'],
-            ],
-            'line-color': 'rgb(190, 189, 188)',
-            'road-gap-width': 8,
-            'road-width': 2,
-            'line-sort-key': 6,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'unclassified'],
-            'line-color': 'rgb(211, 207, 206)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 5,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'residential'],
-            'line-color': 'rgb(211, 207, 206)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 4,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'living_street'],
-            'line-color': 'rgb(207, 207, 207)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 3,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'service'],
-            'line-color': 'rgb(213, 211, 211)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 2,
-        },
-        {
-            filter: [
-                'all',
-                ['==', ['get', 'highway'], 'pedestrian'],
-                ['!=', ['get', 'area'], 'yes'],
-            ],
-            'line-color': 'rgb(184, 183, 182)',
-            'road-gap-width': 2,
-            'road-width': 2,
-            'line-sort-key': 1,
-        },
-        {
-            filter: [
-                'all',
-                ['==', ['get', 'highway'], 'pedestrian'],
-                ['==', ['get', 'area'], 'yes'],
-            ],
-            'line-color': 'rgb(184, 183, 182)',
-            'road-width': 2,
-            'line-sort-key': 1,
-        },
-    ],
+    directives: directives.map(withLineSortKey),
 }
diff --git a/basemap/layers/highway/tunnel_line.js 
b/basemap/layers/highway/tunnel_line.js
index 829be2a8..69714a06 100644
--- a/basemap/layers/highway/tunnel_line.js
+++ b/basemap/layers/highway/tunnel_line.js
@@ -1,3 +1,92 @@
+import {withLineSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'motorway'],
+            ['==', ['get', 'highway'], 'motorway_link'],
+        ],
+        'line-color': 'rgba(241, 188, 198, 1)',
+        'road-width': 12,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'trunk'],
+            ['==', ['get', 'highway'], 'trunk_link'],
+        ],
+        'line-color': 'rgba(252, 215, 204, 1)',
+        'road-width': 8,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'primary'],
+            ['==', ['get', 'highway'], 'primary_link'],
+        ],
+        'line-color': 'rgba(254, 237, 213, 1)',
+        'road-width': 10,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'secondary'],
+            ['==', ['get', 'highway'], 'secondary_link'],
+        ],
+        'line-color': 'rgba(249, 253, 215, 1)',
+        'road-width': 8,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'tertiary'],
+            ['==', ['get', 'highway'], 'tertiary_link'],
+        ],
+        'line-color': 'rgba(255, 255, 255, 1)',
+        'road-width': 8,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'unclassified'],
+        'line-color': 'rgba(242, 242, 242, 1)',
+        'road-width': 4,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'residential'],
+        'line-color': 'rgba(211, 207, 206, 1)',
+        'road-width': 4,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'living_street'],
+        'line-color': 'rgba(245, 245, 245, 1)',
+        'road-width': 4,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'service'],
+        'line-color': 'rgba(242, 242, 242, 1)',
+        'road-width': 4,
+    },
+    {
+        filter: [
+            'all',
+            ['==', ['get', 'highway'], 'pedestrian'],
+            ['!=', ['get', '$type'], 'Polygon'],
+        ],
+        'line-color': 'rgba(221, 221, 232, 1)',
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'raceway'],
+        'line-color': 'rgba(255, 192, 203, 1)',
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'track'],
+        'line-color': 'rgb(177, 140, 63)',
+        'road-width': 2,
+    },
+];
+
 export default {
     id: 'tunnel_line',
     source: 'baremaps',
@@ -14,102 +103,5 @@ export default {
         ['==', ['get', 'layer'], '-1'],
         ['==', ['get', 'covered'], 'yes'],
     ],
-    directives: [
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'motorway'],
-                ['==', ['get', 'highway'], 'motorway_link'],
-            ],
-            'line-color': 'rgba(241, 188, 198, 1)',
-            'road-width': 12,
-            'line-sort-key': 10,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'trunk'],
-                ['==', ['get', 'highway'], 'trunk_link'],
-            ],
-            'line-color': 'rgba(252, 215, 204, 1)',
-            'road-width': 8,
-            'line-sort-key': 9,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'primary'],
-                ['==', ['get', 'highway'], 'primary_link'],
-            ],
-            'line-color': 'rgba(254, 237, 213, 1)',
-            'road-width': 10,
-            'line-sort-key': 8,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'secondary'],
-                ['==', ['get', 'highway'], 'secondary_link'],
-            ],
-            'line-color': 'rgba(249, 253, 215, 1)',
-            'road-width': 8,
-            'line-sort-key': 7,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'tertiary'],
-                ['==', ['get', 'highway'], 'tertiary_link'],
-            ],
-            'line-color': 'rgba(255, 255, 255, 1)',
-            'road-width': 8,
-            'line-sort-key': 6,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'unclassified'],
-            'line-color': 'rgba(242, 242, 242, 1)',
-            'road-width': 4,
-            'line-sort-key': 5,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'residential'],
-            'line-color': 'rgba(211, 207, 206, 1)',
-            'road-width': 4,
-            'line-sort-key': 4,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'living_street'],
-            'line-color': 'rgba(245, 245, 245, 1)',
-            'road-width': 4,
-            'line-sort-key': 3,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'service'],
-            'line-color': 'rgba(242, 242, 242, 1)',
-            'road-width': 4,
-            'line-sort-key': 2,
-        },
-        {
-            filter: [
-                'all',
-                ['==', ['get', 'highway'], 'pedestrian'],
-                ['!=', ['get', '$type'], 'Polygon'],
-            ],
-            'line-color': 'rgba(221, 221, 232, 1)',
-            'road-width': 2,
-            'line-sort-key': 1,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'raceway'],
-            'line-color': 'rgba(255, 192, 203, 1)',
-            'road-width': 2,
-            'line-sort-key': 0,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'track'],
-            'line-color': 'rgb(177, 140, 63)',
-            'road-width': 2,
-            'line-sort-key': 0,
-        },
-    ],
+    directives: directives.map(withLineSortKey),
 }
diff --git a/basemap/layers/highway/tunnel_outline.js 
b/basemap/layers/highway/tunnel_outline.js
index 6d94d462..9ef45f7c 100644
--- a/basemap/layers/highway/tunnel_outline.js
+++ b/basemap/layers/highway/tunnel_outline.js
@@ -1,3 +1,92 @@
+import {withLineSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'motorway'],
+            ['==', ['get', 'highway'], 'motorway_link'],
+        ],
+        'line-color': 'rgba(227, 82, 126, 1)',
+        'road-gap-width': 12,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'trunk'],
+            ['==', ['get', 'highway'], 'trunk_link'],
+        ],
+        'line-color': 'rgba(217, 111, 78, 1)',
+        'road-gap-width': 8,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'primary'],
+            ['==', ['get', 'highway'], 'primary_link'],
+        ],
+        'line-color': 'rgba(192, 147, 62, 1)',
+        'road-gap-width': 10,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'secondary'],
+            ['==', ['get', 'highway'], 'secondary_link'],
+        ],
+        'line-color': 'rgba(154, 166, 67, 1)',
+        'road-gap-width': 8,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'any',
+            ['==', ['get', 'highway'], 'tertiary'],
+            ['==', ['get', 'highway'], 'tertiary_link'],
+        ],
+        'line-color': 'rgba(190, 189, 188, 1)',
+        'road-gap-width': 8,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'unclassified'],
+        'line-color': 'rgba(211, 207, 206, 1)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'residential'],
+        'line-color': 'rgba(211, 207, 206, 1)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'living_street'],
+        'line-color': 'rgba(207, 207, 207, 1)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: ['==', ['get', 'highway'], 'service'],
+        'line-color': 'rgba(213, 211, 211, 1)',
+        'road-gap-width': 4,
+        'road-width': 2,
+    },
+    {
+        filter: [
+            'all',
+            ['==', ['get', 'highway'], 'pedestrian'],
+            ['!=', ['get', '$type'], 'Polygon'],
+        ],
+        'line-color': 'rgba(184, 183, 182, 1)',
+        'road-gap-width': 2,
+        'road-width': 2,
+    },
+];
+
 export default {
     id: 'tunnel_outline',
     source: 'baremaps',
@@ -17,100 +106,5 @@ export default {
     paint: {
         'line-dasharray': [1, 1],
     },
-    directives: [
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'motorway'],
-                ['==', ['get', 'highway'], 'motorway_link'],
-            ],
-            'line-color': 'rgba(227, 82, 126, 1)',
-            'road-gap-width': 12,
-            'road-width': 2,
-            'line-sort-key': 10,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'trunk'],
-                ['==', ['get', 'highway'], 'trunk_link'],
-            ],
-            'line-color': 'rgba(217, 111, 78, 1)',
-            'road-gap-width': 8,
-            'road-width': 2,
-            'line-sort-key': 9,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'primary'],
-                ['==', ['get', 'highway'], 'primary_link'],
-            ],
-            'line-color': 'rgba(192, 147, 62, 1)',
-            'road-gap-width': 10,
-            'road-width': 2,
-            'line-sort-key': 8,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'secondary'],
-                ['==', ['get', 'highway'], 'secondary_link'],
-            ],
-            'line-color': 'rgba(154, 166, 67, 1)',
-            'road-gap-width': 8,
-            'road-width': 2,
-            'line-sort-key': 7,
-        },
-        {
-            filter: [
-                'any',
-                ['==', ['get', 'highway'], 'tertiary'],
-                ['==', ['get', 'highway'], 'tertiary_link'],
-            ],
-            'line-color': 'rgba(190, 189, 188, 1)',
-            'road-gap-width': 8,
-            'road-width': 2,
-            'line-sort-key': 6,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'unclassified'],
-            'line-color': 'rgba(211, 207, 206, 1)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 5,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'residential'],
-            'line-color': 'rgba(211, 207, 206, 1)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 4,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'living_street'],
-            'line-color': 'rgba(207, 207, 207, 1)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 3,
-        },
-        {
-            filter: ['==', ['get', 'highway'], 'service'],
-            'line-color': 'rgba(213, 211, 211, 1)',
-            'road-gap-width': 4,
-            'road-width': 2,
-            'line-sort-key': 2,
-        },
-        {
-            filter: [
-                'all',
-                ['==', ['get', 'highway'], 'pedestrian'],
-                ['!=', ['get', '$type'], 'Polygon'],
-            ],
-            'line-color': 'rgba(184, 183, 182, 1)',
-            'road-gap-width': 2,
-            'road-width': 2,
-            'line-sort-key': 1,
-        },
-    ],
+    directives: directives.map(withLineSortKey),
 }
diff --git a/basemap/layers/landuse/background.js 
b/basemap/layers/landuse/background.js
index 75c06922..6931b687 100644
--- a/basemap/layers/landuse/background.js
+++ b/basemap/layers/landuse/background.js
@@ -1,3 +1,108 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'landuse'], 'village_green'],
+        'fill-color': 'rgb(205, 235, 176)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'salt_pond'],
+        'fill-color': 'rgb(170, 211, 223)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'religious'],
+        'fill-color': 'rgb(205, 204, 201)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'recreation_ground'],
+        'fill-color': 'rgb(223, 252, 226)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'railway'],
+        'fill-color': 'rgb(236, 218, 233)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'quarry'],
+        'fill-color': 'rgb(195, 194, 194)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'plant_nursery'],
+        'fill-color': 'rgb(174, 223, 162)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'military'],
+        'fill-color': 'rgb(242, 228, 221)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'landfill'],
+        'fill-color': 'rgb(182, 182, 144)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'greenfield'],
+        'fill-color': 'rgb(242, 238, 232)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'garages'],
+        'fill-color': 'rgb(222, 221, 204)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'cemetery'],
+        'fill-color': 'rgb(170, 203, 175)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'brownfield'],
+        'fill-color': 'rgb(182, 182, 144)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'basin'],
+        'fill-color': 'rgb(170, 211, 223)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'vineyard'],
+        'fill-color': 'rgb(172, 225, 161)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'meadow'],
+        'fill-color': 'rgb(205, 235, 176)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'farmyard'],
+        'fill-color': 'rgb(238, 213, 179)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'farmland'],
+        'fill-color': 'rgb(237, 240, 214)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'allotments'],
+        'fill-color': 'rgb(202, 224, 191)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'retail'],
+        'fill-color': 'rgb(254, 213, 208)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'industrial'],
+        'fill-color': 'rgb(235, 219, 232)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'residential'],
+        'fill-color': 'rgb(225, 225, 225)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'construction'],
+        'fill-color': 'rgb(199, 199, 180)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'commercial'],
+        'fill-color': 'rgb(242, 216, 217)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'pedestrian'],
+        'fill-color': 'rgb(221, 221, 233)',
+    },
+];
+
 export default {
     id: 'landuse_background',
     type: 'fill',
@@ -6,110 +111,7 @@ export default {
     layout: {
         visibility: 'visible',
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'landuse'], 'village_green'],
-            'fill-color': 'rgb(205, 235, 176)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'salt_pond'],
-            'fill-color': 'rgb(170, 211, 223)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'religious'],
-            'fill-color': 'rgb(205, 204, 201)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'recreation_ground'],
-            'fill-color': 'rgb(223, 252, 226)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'railway'],
-            'fill-color': 'rgb(236, 218, 233)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'quarry'],
-            'fill-color': 'rgb(195, 194, 194)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'plant_nursery'],
-            'fill-color': 'rgb(174, 223, 162)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'military'],
-            'fill-color': 'rgb(242, 228, 221)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'landfill'],
-            'fill-color': 'rgb(182, 182, 144)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'greenfield'],
-            'fill-color': 'rgb(242, 238, 232)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'garages'],
-            'fill-color': 'rgb(222, 221, 204)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'cemetery'],
-            'fill-color': 'rgb(170, 203, 175)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'brownfield'],
-            'fill-color': 'rgb(182, 182, 144)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'basin'],
-            'fill-color': 'rgb(170, 211, 223)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'vineyard'],
-            'fill-color': 'rgb(172, 225, 161)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'meadow'],
-            'fill-color': 'rgb(205, 235, 176)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'farmyard'],
-            'fill-color': 'rgb(238, 213, 179)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'farmland'],
-            'fill-color': 'rgb(237, 240, 214)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'allotments'],
-            'fill-color': 'rgb(202, 224, 191)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'retail'],
-            'fill-color': 'rgb(254, 213, 208)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'industrial'],
-            'fill-color': 'rgb(235, 219, 232)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'residential'],
-            'fill-color': 'rgb(225, 225, 225)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'construction'],
-            'fill-color': 'rgb(199, 199, 180)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'commercial'],
-            'fill-color': 'rgb(242, 216, 217)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'pedestrian'],
-            'fill-color': 'rgb(221, 221, 233)',
-        },
-    ],
-
-
+    directives: directives.map(withFillSortKey),
     paint: {
         'fill-antialias': true,
     },
diff --git a/basemap/layers/landuse/overlay.js 
b/basemap/layers/landuse/overlay.js
index 3dcecac4..9a0f6295 100644
--- a/basemap/layers/landuse/overlay.js
+++ b/basemap/layers/landuse/overlay.js
@@ -1,3 +1,24 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'landuse'], 'grass'],
+        'fill-color': 'rgb(205, 235, 176)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'forest'],
+        'fill-color': 'rgb(171, 210, 156)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'greenhouse_horticulture'],
+        'fill-color': 'rgb(237, 240, 214)',
+    },
+    {
+        filter: ['==', ['get', 'landuse'], 'orchard'],
+        'fill-color': 'rgb(172, 225, 161)',
+    },
+];
+
 export default {
     id: 'landuse_overlay',
     type: 'fill',
@@ -9,22 +30,5 @@ export default {
     paint: {
         'fill-antialias': true,
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'landuse'], 'grass'],
-            'fill-color': 'rgb(205, 235, 176)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'forest'],
-            'fill-color': 'rgb(171, 210, 156)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'greenhouse_horticulture'],
-            'fill-color': 'rgb(237, 240, 214)',
-        },
-        {
-            filter: ['==', ['get', 'landuse'], 'orchard'],
-            'fill-color': 'rgb(172, 225, 161)',
-        },
-    ],
+    directives: directives.map(withFillSortKey),
 }
diff --git a/basemap/layers/leisure/background.js 
b/basemap/layers/leisure/background.js
index c23fbb94..ddbdaede 100644
--- a/basemap/layers/leisure/background.js
+++ b/basemap/layers/leisure/background.js
@@ -1,3 +1,65 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'leisure'], 'swimming_pool'],
+        'fill-color': 'rgb(170, 211, 223)',
+        'fill-outline-color': 'rgb(120, 183, 202)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'sports_centre'],
+        'fill-color': 'rgb(223, 252, 226)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'miniature_golf'],
+        'fill-color': 'rgb(181, 226, 181)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'ice_rink'],
+        'fill-color': 'rgb(221, 236, 236)',
+        'fill-outline-color': 'rgb(140, 220, 189)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'golf_course'],
+        'fill-color': 'rgb(181, 226, 181)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'garden'],
+        'fill-color': 'rgb(205, 235, 176)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'dog_park'],
+        'fill-color': 'rgb(224, 252, 227)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'playground'],
+        'fill-color': 'rgb(223, 252, 226)',
+        'fill-outline-color': 'rgb(164, 221, 169)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'track'],
+        'fill-color': 'rgb(196, 224, 203)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'stadium'],
+        'fill-color': 'rgb(223, 252, 226)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'pitch'],
+        'fill-color': 'rgb(170, 224, 203)',
+        'fill-outline-color': 'rgb(151, 212, 186)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'swimming_pool'],
+        'fill-color': 'rgb(170, 211, 223)',
+        'fill-outline-color': 'rgb(120, 183, 202)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'park'],
+        'fill-color': 'rgb(200, 250, 204)',
+    },
+];
+
 export default {
     id: 'leisure',
     type: 'fill',
@@ -9,70 +71,5 @@ export default {
     paint: {
         'fill-antialias': true,
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'leisure'], 'swimming_pool'],
-            'fill-color': 'rgb(170, 211, 223)',
-            'fill-outline-color': 'rgb(120, 183, 202)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'sports_centre'],
-            'fill-color': 'rgb(223, 252, 226)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'miniature_golf'],
-            'fill-color': 'rgb(181, 226, 181)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'ice_rink'],
-            'fill-color': 'rgb(221, 236, 236)',
-            'fill-outline-color': 'rgb(140, 220, 189)',
-            'fill-sort-key': 10,
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'golf_course'],
-            'fill-color': 'rgb(181, 226, 181)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'garden'],
-            'fill-color': 'rgb(205, 235, 176)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'dog_park'],
-            'fill-color': 'rgb(224, 252, 227)',
-            'fill-sort-key': 10,
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'playground'],
-            'fill-color': 'rgb(223, 252, 226)',
-            'fill-outline-color': 'rgb(164, 221, 169)',
-            'fill-sort-key': 20,
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'track'],
-            'fill-color': 'rgb(196, 224, 203)',
-            'fill-sort-key': 10,
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'stadium'],
-            'fill-color': 'rgb(223, 252, 226)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'pitch'],
-            'fill-color': 'rgb(170, 224, 203)',
-            'fill-outline-color': 'rgb(151, 212, 186)',
-            'fill-sort-key': 10,
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'swimming_pool'],
-            'fill-color': 'rgb(170, 211, 223)',
-            'fill-outline-color': 'rgb(120, 183, 202)',
-            'fill-sort-key': 10,
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'park'],
-            'fill-color': 'rgb(200, 250, 204)',
-            'fill-sort-key': 10,
-        },
-    ],
+    directives: directives.map(withFillSortKey),
 }
diff --git a/basemap/layers/leisure/nature_reserve.js 
b/basemap/layers/leisure/nature_reserve.js
index 02cf89f4..18cf6990 100644
--- a/basemap/layers/leisure/nature_reserve.js
+++ b/basemap/layers/leisure/nature_reserve.js
@@ -1,3 +1,13 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives =  [
+    {
+        filter: ['==', 'leisure', 'nature_reserve'],
+        'line-width': 5,
+        'line-color': 'rgba(230, 233, 222, 0.5)',
+    },
+];
+
 export default {
     id: 'leisure_nature_reserve',
     type: 'line',
@@ -6,11 +16,5 @@ export default {
     layout: {
         visibility: 'visible',
     },
-    directives: [
-        {
-            filter: ['==', 'leisure', 'nature_reserve'],
-            'line-width': 5,
-            'line-color': 'rgba(230, 233, 222, 0.5)',
-        },
-    ],
+    directives: directives.map(withFillSortKey),
 }
diff --git a/basemap/layers/leisure/overlay.js 
b/basemap/layers/leisure/overlay.js
index c7cf3389..f23b9f68 100644
--- a/basemap/layers/leisure/overlay.js
+++ b/basemap/layers/leisure/overlay.js
@@ -1,3 +1,13 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'leisure'], 'marina'],
+        'fill-color': 'rgb(181, 208, 208)',
+        'fill-outline-color': 'rgb(164, 187, 212)',
+    },
+];
+
 export default {
     id: 'leisure_overlay',
     type: 'fill',
@@ -9,11 +19,5 @@ export default {
     paint: {
         'fill-antialias': true,
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'leisure'], 'marina'],
-            'fill-color': 'rgb(181, 208, 208)',
-            'fill-outline-color': 'rgb(164, 187, 212)',
-        },
-    ],
+    directives: directives.map(withFillSortKey),
 }
diff --git a/basemap/layers/man_made/bridge.js 
b/basemap/layers/man_made/bridge.js
index b5c6e9f5..18332b8f 100644
--- a/basemap/layers/man_made/bridge.js
+++ b/basemap/layers/man_made/bridge.js
@@ -1,3 +1,12 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'man_made'], 'bridge'],
+        'fill-color': 'rgb(184, 184, 184)',
+    },
+];
+
 export default {
     id: 'man_made_bridge',
     type: 'fill',
@@ -6,12 +15,7 @@ export default {
     layout: {
         visibility: 'visible',
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'man_made'], 'bridge'],
-            'fill-color': 'rgb(184, 184, 184)',
-        },
-    ],
+    directives: directives.map(withFillSortKey),
     paint: {
         'fill-antialias': true,
     },
diff --git a/basemap/layers/natural/background.js 
b/basemap/layers/natural/background.js
index 9f70bfd5..fa3dc385 100644
--- a/basemap/layers/natural/background.js
+++ b/basemap/layers/natural/background.js
@@ -1,3 +1,40 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'natural'], 'glacier'],
+        'fill-color': 'rgb(221, 236, 236)'
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'wood'],
+        'fill-color': 'rgb(157, 202, 138)'
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'heath'],
+        'fill-color': 'rgb(214, 217, 159)'
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'grassland'],
+        'fill-color': 'rgb(207, 236, 177)'
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'bare_rock'],
+        'fill-color': 'rgb(217, 212, 206)'
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'scree'],
+        'fill-color': 'rgb(232, 223, 216)'
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'shingle'],
+        'fill-color': 'rgb(232, 223, 216)'
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'sand'],
+        'fill-color': 'rgb(240, 229, 196)'
+    },
+];
+
 export default {
     id: 'natural',
     type: 'fill',
@@ -10,38 +47,5 @@ export default {
     paint: {
         'fill-antialias': true,
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'natural'], 'glacier'],
-            'fill-color': 'rgb(221, 236, 236)'
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'wood'],
-            'fill-color': 'rgb(157, 202, 138)'
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'heath'],
-            'fill-color': 'rgb(214, 217, 159)'
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'grassland'],
-            'fill-color': 'rgb(207, 236, 177)'
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'bare_rock'],
-            'fill-color': 'rgb(217, 212, 206)'
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'scree'],
-            'fill-color': 'rgb(232, 223, 216)'
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'shingle'],
-            'fill-color': 'rgb(232, 223, 216)'
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'sand'],
-            'fill-color': 'rgb(240, 229, 196)'
-        },
-    ]
+    directives: directives.map(withFillSortKey),
 }
diff --git a/basemap/layers/natural/overlay.js 
b/basemap/layers/natural/overlay.js
index e7fef47f..2b760d6d 100644
--- a/basemap/layers/natural/overlay.js
+++ b/basemap/layers/natural/overlay.js
@@ -1,3 +1,25 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'natural'], 'beach'],
+        'fill-color': 'rgb(255, 241, 186)'
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'water'],
+        'fill-color': 'rgb(170, 211, 223)',
+        'fill-sort-key': 10,
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'wetland'],
+        'fill-color': 'rgb(213, 231, 211)'
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'scrub'],
+        'fill-color': 'rgb(201, 216, 173)'
+    }
+];
+
 export default {
     id: 'natural_overlay',
     type: 'fill',
@@ -9,23 +31,5 @@ export default {
     paint: {
         'fill-antialias': true,
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'natural'], 'beach'],
-            'fill-color': 'rgb(255, 241, 186)'
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'water'],
-            'fill-color': 'rgb(170, 211, 223)',
-            'fill-sort-key': 10,
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'wetland'],
-            'fill-color': 'rgb(213, 231, 211)'
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'scrub'],
-            'fill-color': 'rgb(201, 216, 173)'
-        }
-    ]
+    directives: directives.map(withFillSortKey),
 }
diff --git a/basemap/layers/ocean/background.js 
b/basemap/layers/ocean/background.js
index 18f417ff..a0ad4c2c 100644
--- a/basemap/layers/ocean/background.js
+++ b/basemap/layers/ocean/background.js
@@ -1,3 +1,13 @@
+import {withFillSortKey} from "../../utils/utils.js";
+
+let directives = [
+    {
+        filter: ['==', ['get', 'ocean'], 'water'],
+        'fill-color': 'rgb(170, 211, 223)',
+        'fill-sort-key': 10,
+    },
+];
+
 export default {
     id: 'ocean',
     type: 'fill',
@@ -9,11 +19,5 @@ export default {
     paint: {
         'fill-antialias': true,
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'ocean'], 'water'],
-            'fill-color': 'rgb(170, 211, 223)',
-            'fill-sort-key': 10,
-        },
-    ]
+    directives: directives.map(withFillSortKey),
 }
diff --git a/basemap/layers/point/icon.js b/basemap/layers/point/icon.js
index 1acfb3c3..ac94f962 100644
--- a/basemap/layers/point/icon.js
+++ b/basemap/layers/point/icon.js
@@ -1,4 +1,870 @@
-import layer from '../../utils/layer.js'
+let directives = [
+    // Amenity: sustenance
+    {
+        filter: ['==', ['get', 'amenity'], 'bar'],
+        'icon-image': 'bar',
+        'icon-color': 'rgb(199, 116, 0)',
+        'text-color': 'rgb(199, 116, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'biergarten'],
+        'icon-image': 'biergarten',
+        'icon-color': 'rgb(199, 116, 0)',
+        'text-color': 'rgb(199, 116, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'cafe'],
+        'icon-image': 'cafe',
+        'icon-color': 'rgb(199, 116, 0)',
+        'text-color': 'rgb(199, 116, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'fast_food'],
+        'icon-image': 'fast_food',
+        'icon-color': 'rgb(199, 116, 0)',
+        'text-color': 'rgb(199, 116, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'food_court'],
+        'icon-image': 'food_court',
+        'icon-color': 'rgb(199, 116, 0)',
+        'text-color': 'rgb(199, 116, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'ice_cream'],
+        'icon-image': 'ice_cream',
+        'icon-color': 'rgb(199, 116, 0)',
+        'text-color': 'rgb(199, 116, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'pub'],
+        'icon-image': 'pub',
+        'icon-color': 'rgb(199, 116, 0)',
+        'text-color': 'rgb(199, 116, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'restaurant'],
+        'icon-image': 'restaurant',
+        'icon-color': 'rgb(199, 116, 0)',
+        'text-color': 'rgb(199, 116, 0)',
+    },
+
+    // Amenity: education
+    // {
+    //     filter: ['==', ['get', 'amenity'], 'driving_school'],
+    //     'icon-image': 'driving_school',
+    //     'icon-color': 'rgb(172, 58, 173)',
+    //     'text-color': 'rgb(172, 58, 173)',
+    // },
+    {
+        filter: ['==', ['get', 'amenity'], 'library'],
+        'icon-image': 'library',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+
+    // Amenity: transportation
+    {
+        filter: ['==', ['get', 'amenity'], 'bicycle_parking'],
+        'icon-image': 'bicycle_parking',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'bicycle_repair_station'],
+        'icon-image': 'bicycle_repair_station',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'bicycle_rental'],
+        'icon-image': 'rental_bicycle',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'boat_rental'],
+        'icon-image': 'boat_rental',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'bus_station'],
+        'icon-image': 'bus_station',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'car_rental'],
+        'icon-image': 'rental_car',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'car_wash'],
+        'icon-image': 'car_wash',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'vehicle_inspection'],
+        'icon-image': 'vehicle_inspection',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'charging_station'],
+        'icon-image': 'charging_station',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'ferry_terminal'],
+        'icon-image': 'ferry',
+        'icon-color': 'rgb(132, 97, 196)',
+        'text-color': 'rgb(132, 97, 196)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'fuel'],
+        'icon-image': 'fuel',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'motorcycle_parking'],
+        'icon-image': 'motorcycle_parking',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'parking'],
+        'icon-image': 'parking',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'parking_entrance'],
+        'icon-image': 'entrance',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'taxi'],
+        'icon-image': 'taxi',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+
+    // Amenity: financial
+    {
+        filter: ['==', ['get', 'amenity'], 'atm'],
+        'icon-image': 'atm',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'bank'],
+        'icon-image': 'bank',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'bureau_de_change'],
+        'icon-image': 'bureau_de_change',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+
+    // Amenity: healthcare
+    {
+        filter: ['==', ['get', 'amenity'], 'clinic'],
+        'icon-image': 'hospital',
+        'icon-color': 'rgb(191, 0, 0)',
+        'text-color': 'rgb(191, 0, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'dentist'],
+        'icon-image': 'dentist',
+        'icon-color': 'rgb(191, 0, 0)',
+        'text-color': 'rgb(191, 0, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'doctors'],
+        'icon-image': 'doctors',
+        'icon-color': 'rgb(191, 0, 0)',
+        'text-color': 'rgb(191, 0, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'hospital'],
+        'icon-image': 'hospital',
+        'icon-color': 'rgb(191, 0, 0)',
+        'text-color': 'rgb(191, 0, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'nursing_home'],
+        'icon-image': 'nursing_home',
+        'icon-color': 'rgb(76, 76, 0)',
+        'text-color': 'rgb(76, 76, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'pharmacy'],
+        'icon-image': 'pharmacy',
+        'icon-color': 'rgb(191, 0, 0)',
+        'text-color': 'rgb(191, 0, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'social_facility'],
+        'icon-image': 'social_facility',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'veterinary'],
+        'icon-image': 'veterinary',
+        'icon-color': 'rgb(191, 0, 0)',
+        'text-color': 'rgb(191, 0, 0)',
+    },
+
+    // Amenity: entertainment, arts & culture
+    {
+        filter: ['==', ['get', 'amenity'], 'arts_centre'],
+        'icon-image': 'arts_centre',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'casino'],
+        'icon-image': 'casino',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'cinema'],
+        'icon-image': 'cinema',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'community_centre'],
+        'icon-image': 'community_centre',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'fountain'],
+        'icon-image': 'fountain',
+        'icon-color': 'rgb(87, 104, 236)',
+        'text-color': 'rgb(87, 104, 236)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'nightclub'],
+        'icon-image': 'nightclub',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'public_bookcase'],
+        'icon-image': 'public_bookcase',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'theatre'],
+        'icon-image': 'theatre',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+
+    // Amenity: public service
+    {
+        filter: ['==', ['get', 'amenity'], 'courthouse'],
+        'icon-image': 'courthouse',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'fire_station'],
+        'icon-image': 'firestation',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'police'],
+        'icon-image': 'police',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'post_box'],
+        'icon-image': 'post_box',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'post_office'],
+        'icon-image': 'post_office',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'prison'],
+        'icon-image': 'prison',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'townhall'],
+        'icon-image': 'town_hall',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+
+    // Amenity: facilities
+    {
+        filter: ['==', ['get', 'amenity'], 'bbq'],
+        'icon-image': 'bbq',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'bench'],
+        'icon-image': 'bench',
+        'icon-color': 'rgb(102, 102, 102)',
+        'text-color': 'rgb(102, 102, 102)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'drinking_water'],
+        'icon-image': 'drinking_water',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'shelter'],
+        'icon-image': 'shelter',
+        'icon-color': 'rgb(102, 102, 102)',
+        'text-color': 'rgb(102, 102, 102)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'shower'],
+        'icon-image': 'shower',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'telephone'],
+        'icon-image': 'telephone',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'toilets'],
+        'icon-image': 'toilets',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+
+    // Amenity: waste management
+    {
+        filter: ['==', ['get', 'amenity'], 'recycling'],
+        'icon-image': 'recycling',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'waste_basket'],
+        'icon-image': 'waste_basket',
+        'icon-color': 'rgb(102, 102, 102)',
+        'text-color': 'rgb(102, 102, 102)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'waste_disposal'],
+        'icon-image': 'waste_disposal',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+
+    // Amenity: Others
+    {
+        filter: ['==', ['get', 'amenity'], 'childcare'],
+        'icon-image': 'place-6',
+        'icon-color': 'rgb(76, 76, 0)',
+        'text-color': 'rgb(76, 76, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'hunting_stand'],
+        'icon-image': 'hunting_stand',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'internet_cafe'],
+        'icon-image': 'internet_cafe',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'marketplace'],
+        'icon-image': 'marketplace',
+        'icon-color': 'rgb(172, 58, 173)',
+        'text-color': 'rgb(172, 58, 173)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'place_of_worship'],
+        'icon-image': 'place_of_worship',
+        'icon-color': 'rgb(0, 0, 0)',
+        'text-color': 'rgb(0, 0, 0)',
+    },
+    {
+        filter: ['==', ['get', 'amenity'], 'public_bath'],
+        'icon-image': 'public_bath',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+
+    // Historic
+    {
+        filter: ['==', ['get', 'historic'], 'archaeological_site'],
+        'icon-image': 'archaeological_site',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'historic'], 'castle'],
+        'icon-image': 'castle',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'historic'], 'city_gate'],
+        'icon-image': 'city_gate',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'historic'], 'fort'],
+        'icon-image': 'fort',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'historic'], 'manor'],
+        'icon-image': 'manor',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'historic'], 'memorial'],
+        'icon-image': 'memorial',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'historic'], 'monument'],
+        'icon-image': 'monument',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'historic'], 'wayside_cross'],
+        'icon-image': 'wayside_cross',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'historic'], 'wayside_shrine'],
+        'icon-image': 'wayside_shrine',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+
+    // Leisure
+    {
+        filter: ['==', ['get', 'leisure'], 'amusement_arcade'],
+        'icon-image': 'amusement_arcade',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'beach_resort'],
+        'icon-image': 'beach_resort',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'bird_hide'],
+        'icon-image': 'bird_hide',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'bowling_alley'],
+        'icon-image': 'bowling_alley',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'firepit'],
+        'icon-image': 'firepit',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'fishing'],
+        'icon-image': 'fishing',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'fitness_centre'],
+        'icon-image': 'sports',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'fitness_station'],
+        'icon-image': 'sports',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'golf_course'],
+        'icon-image': 'golf_course',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'miniature_golf'],
+        'icon-image': 'miniature_golf',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'outdoor_seating'],
+        'icon-image': 'outdoor_seating',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'picnic_table'],
+        'icon-image': 'picnic',
+        'icon-color': 'rgb(102, 102, 102)',
+        'text-color': 'rgb(102, 102, 102)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'playground'],
+        'icon-image': 'playground',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'sauna'],
+        'icon-image': 'sauna',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'slipway'],
+        'icon-image': 'slipway',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'swimming_area'],
+        'icon-image': 'swimming_area',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+    {
+        filter: ['==', ['get', 'leisure'], 'water_park'],
+        'icon-image': 'water_park',
+        'icon-color': 'rgb(13, 134, 22)',
+        'text-color': 'rgb(13, 134, 22)',
+    },
+
+    // Man-made
+    {
+        filter: ['==', ['get', 'man_made'], 'chimney'],
+        'icon-image': 'chimney',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'communications_tower'],
+        'icon-image': 'communications_tower',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'crane'],
+        'icon-image': 'crane',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'cross'],
+        'icon-image': 'cross',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'lighthouse'],
+        'icon-image': 'lighthouse',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'mast'],
+        'icon-image': 'mast',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'obelisk'],
+        'icon-image': 'obelisk',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'silo'],
+        'icon-image': 'silo',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'storage_tank'],
+        'icon-image': 'storage_tank',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'telescope'],
+        'icon-image': 'telescope',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'tower'],
+        'icon-image': 'tower_generic',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'water_tower'],
+        'icon-image': 'water_tower',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'man_made'], 'windmill'],
+        'icon-image': 'windmill',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+
+    // Military
+    {
+        filter: ['==', ['get', 'military'], 'bunker'],
+        'icon-image': 'bunker',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+
+    // Natural
+    {
+        filter: ['==', ['get', 'natural'], 'spring'],
+        'icon-image': 'spring',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'cave_entrance'],
+        'icon-image': 'entrance',
+        'icon-color': 'rgb(85, 85, 85)',
+        'text-color': 'rgb(85, 85, 85)',
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'peak'],
+        'icon-image': 'peak',
+        'icon-color': 'rgb(209, 144, 85)',
+        'text-color': 'rgb(209, 144, 85)',
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'saddle'],
+        'icon-image': 'saddle',
+        'icon-color': 'rgb(209, 144, 85)',
+        'text-color': 'rgb(209, 144, 85)',
+    },
+    {
+        filter: ['==', ['get', 'natural'], 'volcano'],
+        'icon-image': 'volcano',
+        'icon-color': 'rgb(212, 0, 0)',
+        'text-color': 'rgb(212, 0, 0)',
+    },
+
+    // Railway: stations and stops
+    {
+        filter: ['==', ['get', 'railway'], 'halt'],
+        'icon-image': 'place-6',
+        'icon-color': 'rgb(122, 129, 177)',
+        'text-color': 'rgb(122, 129, 177)',
+    },
+    {
+        filter: ['==', ['get', 'railway'], 'station'],
+        'icon-image': 'place-6',
+        'icon-color': 'rgb(122, 129, 177)',
+        'text-color': 'rgb(122, 129, 177)',
+    },
+    {
+        filter: ['==', ['get', 'railway'], 'subway_entrance'],
+        'icon-image': 'entrance',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'railway'], 'tram_stop'],
+        'icon-image': 'tram_stop',
+        'icon-color': 'rgb(122, 129, 177)',
+        'text-color': 'rgb(122, 129, 177)',
+    },
+
+    // Railway: other railways
+    {
+        filter: ['==', ['get', 'railway'], 'crossing'],
+        'icon-image': 'level_crossing',
+        'icon-color': 'rgb(102, 102, 102)',
+        'text-color': 'rgb(102, 102, 102)',
+    },
+    {
+        filter: ['==', ['get', 'railway'], 'level_crossing'],
+        'icon-image': 'level_crossing',
+        'icon-color': 'rgb(102, 102, 102)',
+        'text-color': 'rgb(102, 102, 102)',
+    },
+
+    // Tourism
+    {
+        filter: ['==', ['get', 'tourism'], 'alpine_hut'],
+        'icon-image': 'alpine_hut',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'apartment'],
+        'icon-image': 'apartment',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'artwork'],
+        'icon-image': 'artwork',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'artwork'],
+        'icon-image': 'artwork',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'camp_site'],
+        'icon-image': 'camping',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'caravan_site'],
+        'icon-image': 'caravan_park',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'chalet'],
+        'icon-image': 'chalet',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'gallery'],
+        'icon-image': 'art',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'guest_house'],
+        'icon-image': 'guest_house',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'hostel'],
+        'icon-image': 'hostel',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'hotel'],
+        'icon-image': 'hotel',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'motel'],
+        'icon-image': 'motel',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'museum'],
+        'icon-image': 'museum',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'picnic_site'],
+        'icon-image': 'picnic',
+        'icon-color': 'rgb(102, 102, 102)',
+        'text-color': 'rgb(102, 102, 102)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'viewpoint'],
+        'icon-image': 'viewpoint',
+        'icon-color': 'rgb(115, 74, 7)',
+        'text-color': 'rgb(115, 74, 7)',
+    },
+    {
+        filter: ['==', ['get', 'tourism'], 'wilderness_hut'],
+        'icon-image': 'wilderness_hut',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+
+    // Waterway: barriers on waterways
+    {
+        filter: ['==', ['get', 'waterway'], 'dam'],
+        'icon-image': 'dam',
+        'icon-color': 'rgb(173, 173, 173)',
+        'text-color': 'rgb(173, 173, 173)',
+    },
+    {
+        filter: ['==', ['get', 'waterway'], 'weir'],
+        'icon-image': 'weir',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'waterway'], 'waterfall'],
+        'icon-image': 'waterfall',
+        'icon-color': 'rgb(0, 146, 219)',
+        'text-color': 'rgb(0, 146, 219)',
+    },
+    {
+        filter: ['==', ['get', 'waterway'], 'lock_gate'],
+        'icon-image': 'lock_gate',
+        'icon-color': 'rgb(173, 173, 173)',
+        'text-color': 'rgb(173, 173, 173)',
+    },
+];
 
 export default {
     id: 'icon',
@@ -25,871 +891,5 @@ export default {
         'text-halo-width': 1,
         'text-halo-color': 'rgba(255, 255, 255, 0.8)',
     },
-    directives: [
-        // Amenity: sustenance
-        {
-            filter: ['==', ['get', 'amenity'], 'bar'],
-            'icon-image': 'bar',
-            'icon-color': 'rgb(199, 116, 0)',
-            'text-color': 'rgb(199, 116, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'biergarten'],
-            'icon-image': 'biergarten',
-            'icon-color': 'rgb(199, 116, 0)',
-            'text-color': 'rgb(199, 116, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'cafe'],
-            'icon-image': 'cafe',
-            'icon-color': 'rgb(199, 116, 0)',
-            'text-color': 'rgb(199, 116, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'fast_food'],
-            'icon-image': 'fast_food',
-            'icon-color': 'rgb(199, 116, 0)',
-            'text-color': 'rgb(199, 116, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'food_court'],
-            'icon-image': 'food_court',
-            'icon-color': 'rgb(199, 116, 0)',
-            'text-color': 'rgb(199, 116, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'ice_cream'],
-            'icon-image': 'ice_cream',
-            'icon-color': 'rgb(199, 116, 0)',
-            'text-color': 'rgb(199, 116, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'pub'],
-            'icon-image': 'pub',
-            'icon-color': 'rgb(199, 116, 0)',
-            'text-color': 'rgb(199, 116, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'restaurant'],
-            'icon-image': 'restaurant',
-            'icon-color': 'rgb(199, 116, 0)',
-            'text-color': 'rgb(199, 116, 0)',
-        },
-
-        // Amenity: education
-        // {
-        //     filter: ['==', ['get', 'amenity'], 'driving_school'],
-        //     'icon-image': 'driving_school',
-        //     'icon-color': 'rgb(172, 58, 173)',
-        //     'text-color': 'rgb(172, 58, 173)',
-        // },
-        {
-            filter: ['==', ['get', 'amenity'], 'library'],
-            'icon-image': 'library',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-
-        // Amenity: transportation
-        {
-            filter: ['==', ['get', 'amenity'], 'bicycle_parking'],
-            'icon-image': 'bicycle_parking',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'bicycle_repair_station'],
-            'icon-image': 'bicycle_repair_station',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'bicycle_rental'],
-            'icon-image': 'rental_bicycle',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'boat_rental'],
-            'icon-image': 'boat_rental',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'bus_station'],
-            'icon-image': 'bus_station',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'car_rental'],
-            'icon-image': 'rental_car',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'car_wash'],
-            'icon-image': 'car_wash',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'vehicle_inspection'],
-            'icon-image': 'vehicle_inspection',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'charging_station'],
-            'icon-image': 'charging_station',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'ferry_terminal'],
-            'icon-image': 'ferry',
-            'icon-color': 'rgb(132, 97, 196)',
-            'text-color': 'rgb(132, 97, 196)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'fuel'],
-            'icon-image': 'fuel',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'motorcycle_parking'],
-            'icon-image': 'motorcycle_parking',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'parking'],
-            'icon-image': 'parking',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'parking_entrance'],
-            'icon-image': 'entrance',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'taxi'],
-            'icon-image': 'taxi',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-
-        // Amenity: financial
-        {
-            filter: ['==', ['get', 'amenity'], 'atm'],
-            'icon-image': 'atm',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'bank'],
-            'icon-image': 'bank',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'bureau_de_change'],
-            'icon-image': 'bureau_de_change',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-
-        // Amenity: healthcare
-        {
-            filter: ['==', ['get', 'amenity'], 'clinic'],
-            'icon-image': 'hospital',
-            'icon-color': 'rgb(191, 0, 0)',
-            'text-color': 'rgb(191, 0, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'dentist'],
-            'icon-image': 'dentist',
-            'icon-color': 'rgb(191, 0, 0)',
-            'text-color': 'rgb(191, 0, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'doctors'],
-            'icon-image': 'doctors',
-            'icon-color': 'rgb(191, 0, 0)',
-            'text-color': 'rgb(191, 0, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'hospital'],
-            'icon-image': 'hospital',
-            'icon-color': 'rgb(191, 0, 0)',
-            'text-color': 'rgb(191, 0, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'nursing_home'],
-            'icon-image': 'nursing_home',
-            'icon-color': 'rgb(76, 76, 0)',
-            'text-color': 'rgb(76, 76, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'pharmacy'],
-            'icon-image': 'pharmacy',
-            'icon-color': 'rgb(191, 0, 0)',
-            'text-color': 'rgb(191, 0, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'social_facility'],
-            'icon-image': 'social_facility',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'veterinary'],
-            'icon-image': 'veterinary',
-            'icon-color': 'rgb(191, 0, 0)',
-            'text-color': 'rgb(191, 0, 0)',
-        },
-
-        // Amenity: entertainment, arts & culture
-        {
-            filter: ['==', ['get', 'amenity'], 'arts_centre'],
-            'icon-image': 'arts_centre',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'casino'],
-            'icon-image': 'casino',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'cinema'],
-            'icon-image': 'cinema',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'community_centre'],
-            'icon-image': 'community_centre',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'fountain'],
-            'icon-image': 'fountain',
-            'icon-color': 'rgb(87, 104, 236)',
-            'text-color': 'rgb(87, 104, 236)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'nightclub'],
-            'icon-image': 'nightclub',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'public_bookcase'],
-            'icon-image': 'public_bookcase',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'theatre'],
-            'icon-image': 'theatre',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-
-        // Amenity: public service
-        {
-            filter: ['==', ['get', 'amenity'], 'courthouse'],
-            'icon-image': 'courthouse',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'fire_station'],
-            'icon-image': 'firestation',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'police'],
-            'icon-image': 'police',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'post_box'],
-            'icon-image': 'post_box',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'post_office'],
-            'icon-image': 'post_office',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'prison'],
-            'icon-image': 'prison',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'townhall'],
-            'icon-image': 'town_hall',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-
-        // Amenity: facilities
-        {
-            filter: ['==', ['get', 'amenity'], 'bbq'],
-            'icon-image': 'bbq',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'bench'],
-            'icon-image': 'bench',
-            'icon-color': 'rgb(102, 102, 102)',
-            'text-color': 'rgb(102, 102, 102)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'drinking_water'],
-            'icon-image': 'drinking_water',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'shelter'],
-            'icon-image': 'shelter',
-            'icon-color': 'rgb(102, 102, 102)',
-            'text-color': 'rgb(102, 102, 102)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'shower'],
-            'icon-image': 'shower',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'telephone'],
-            'icon-image': 'telephone',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'toilets'],
-            'icon-image': 'toilets',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-
-        // Amenity: waste management
-        {
-            filter: ['==', ['get', 'amenity'], 'recycling'],
-            'icon-image': 'recycling',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'waste_basket'],
-            'icon-image': 'waste_basket',
-            'icon-color': 'rgb(102, 102, 102)',
-            'text-color': 'rgb(102, 102, 102)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'waste_disposal'],
-            'icon-image': 'waste_disposal',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-
-        // Amenity: Others
-        {
-            filter: ['==', ['get', 'amenity'], 'childcare'],
-            'icon-image': 'place-6',
-            'icon-color': 'rgb(76, 76, 0)',
-            'text-color': 'rgb(76, 76, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'hunting_stand'],
-            'icon-image': 'hunting_stand',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'internet_cafe'],
-            'icon-image': 'internet_cafe',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'marketplace'],
-            'icon-image': 'marketplace',
-            'icon-color': 'rgb(172, 58, 173)',
-            'text-color': 'rgb(172, 58, 173)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'place_of_worship'],
-            'icon-image': 'place_of_worship',
-            'icon-color': 'rgb(0, 0, 0)',
-            'text-color': 'rgb(0, 0, 0)',
-        },
-        {
-            filter: ['==', ['get', 'amenity'], 'public_bath'],
-            'icon-image': 'public_bath',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-
-        // Historic
-        {
-            filter: ['==', ['get', 'historic'], 'archaeological_site'],
-            'icon-image': 'archaeological_site',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'historic'], 'castle'],
-            'icon-image': 'castle',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'historic'], 'city_gate'],
-            'icon-image': 'city_gate',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'historic'], 'fort'],
-            'icon-image': 'fort',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'historic'], 'manor'],
-            'icon-image': 'manor',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'historic'], 'memorial'],
-            'icon-image': 'memorial',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'historic'], 'monument'],
-            'icon-image': 'monument',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'historic'], 'wayside_cross'],
-            'icon-image': 'wayside_cross',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'historic'], 'wayside_shrine'],
-            'icon-image': 'wayside_shrine',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-
-        // Leisure
-        {
-            filter: ['==', ['get', 'leisure'], 'amusement_arcade'],
-            'icon-image': 'amusement_arcade',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'beach_resort'],
-            'icon-image': 'beach_resort',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'bird_hide'],
-            'icon-image': 'bird_hide',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'bowling_alley'],
-            'icon-image': 'bowling_alley',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'firepit'],
-            'icon-image': 'firepit',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'fishing'],
-            'icon-image': 'fishing',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'fitness_centre'],
-            'icon-image': 'sports',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'fitness_station'],
-            'icon-image': 'sports',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'golf_course'],
-            'icon-image': 'golf_course',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'miniature_golf'],
-            'icon-image': 'miniature_golf',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'outdoor_seating'],
-            'icon-image': 'outdoor_seating',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'picnic_table'],
-            'icon-image': 'picnic',
-            'icon-color': 'rgb(102, 102, 102)',
-            'text-color': 'rgb(102, 102, 102)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'playground'],
-            'icon-image': 'playground',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'sauna'],
-            'icon-image': 'sauna',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'slipway'],
-            'icon-image': 'slipway',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'swimming_area'],
-            'icon-image': 'swimming_area',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-        {
-            filter: ['==', ['get', 'leisure'], 'water_park'],
-            'icon-image': 'water_park',
-            'icon-color': 'rgb(13, 134, 22)',
-            'text-color': 'rgb(13, 134, 22)',
-        },
-
-        // Man-made
-        {
-            filter: ['==', ['get', 'man_made'], 'chimney'],
-            'icon-image': 'chimney',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'communications_tower'],
-            'icon-image': 'communications_tower',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'crane'],
-            'icon-image': 'crane',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'cross'],
-            'icon-image': 'cross',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'lighthouse'],
-            'icon-image': 'lighthouse',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'mast'],
-            'icon-image': 'mast',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'obelisk'],
-            'icon-image': 'obelisk',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'silo'],
-            'icon-image': 'silo',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'storage_tank'],
-            'icon-image': 'storage_tank',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'telescope'],
-            'icon-image': 'telescope',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'tower'],
-            'icon-image': 'tower_generic',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'water_tower'],
-            'icon-image': 'water_tower',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'man_made'], 'windmill'],
-            'icon-image': 'windmill',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-
-        // Military
-        {
-            filter: ['==', ['get', 'military'], 'bunker'],
-            'icon-image': 'bunker',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-
-        // Natural
-        {
-            filter: ['==', ['get', 'natural'], 'spring'],
-            'icon-image': 'spring',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'cave_entrance'],
-            'icon-image': 'entrance',
-            'icon-color': 'rgb(85, 85, 85)',
-            'text-color': 'rgb(85, 85, 85)',
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'peak'],
-            'icon-image': 'peak',
-            'icon-color': 'rgb(209, 144, 85)',
-            'text-color': 'rgb(209, 144, 85)',
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'saddle'],
-            'icon-image': 'saddle',
-            'icon-color': 'rgb(209, 144, 85)',
-            'text-color': 'rgb(209, 144, 85)',
-        },
-        {
-            filter: ['==', ['get', 'natural'], 'volcano'],
-            'icon-image': 'volcano',
-            'icon-color': 'rgb(212, 0, 0)',
-            'text-color': 'rgb(212, 0, 0)',
-        },
-
-        // Railway: stations and stops
-        {
-            filter: ['==', ['get', 'railway'], 'halt'],
-            'icon-image': 'place-6',
-            'icon-color': 'rgb(122, 129, 177)',
-            'text-color': 'rgb(122, 129, 177)',
-        },
-        {
-            filter: ['==', ['get', 'railway'], 'station'],
-            'icon-image': 'place-6',
-            'icon-color': 'rgb(122, 129, 177)',
-            'text-color': 'rgb(122, 129, 177)',
-        },
-        {
-            filter: ['==', ['get', 'railway'], 'subway_entrance'],
-            'icon-image': 'entrance',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'railway'], 'tram_stop'],
-            'icon-image': 'tram_stop',
-            'icon-color': 'rgb(122, 129, 177)',
-            'text-color': 'rgb(122, 129, 177)',
-        },
-
-        // Railway: other railways
-        {
-            filter: ['==', ['get', 'railway'], 'crossing'],
-            'icon-image': 'level_crossing',
-            'icon-color': 'rgb(102, 102, 102)',
-            'text-color': 'rgb(102, 102, 102)',
-        },
-        {
-            filter: ['==', ['get', 'railway'], 'level_crossing'],
-            'icon-image': 'level_crossing',
-            'icon-color': 'rgb(102, 102, 102)',
-            'text-color': 'rgb(102, 102, 102)',
-        },
-
-        // Tourism
-        {
-            filter: ['==', ['get', 'tourism'], 'alpine_hut'],
-            'icon-image': 'alpine_hut',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'apartment'],
-            'icon-image': 'apartment',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'artwork'],
-            'icon-image': 'artwork',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'artwork'],
-            'icon-image': 'artwork',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'camp_site'],
-            'icon-image': 'camping',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'caravan_site'],
-            'icon-image': 'caravan_park',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'chalet'],
-            'icon-image': 'chalet',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'gallery'],
-            'icon-image': 'art',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'guest_house'],
-            'icon-image': 'guest_house',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'hostel'],
-            'icon-image': 'hostel',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'hotel'],
-            'icon-image': 'hotel',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'motel'],
-            'icon-image': 'motel',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'museum'],
-            'icon-image': 'museum',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'picnic_site'],
-            'icon-image': 'picnic',
-            'icon-color': 'rgb(102, 102, 102)',
-            'text-color': 'rgb(102, 102, 102)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'viewpoint'],
-            'icon-image': 'viewpoint',
-            'icon-color': 'rgb(115, 74, 7)',
-            'text-color': 'rgb(115, 74, 7)',
-        },
-        {
-            filter: ['==', ['get', 'tourism'], 'wilderness_hut'],
-            'icon-image': 'wilderness_hut',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-
-        // Waterway: barriers on waterways
-        {
-            filter: ['==', ['get', 'waterway'], 'dam'],
-            'icon-image': 'dam',
-            'icon-color': 'rgb(173, 173, 173)',
-            'text-color': 'rgb(173, 173, 173)',
-        },
-        {
-            filter: ['==', ['get', 'waterway'], 'weir'],
-            'icon-image': 'weir',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'waterway'], 'waterfall'],
-            'icon-image': 'waterfall',
-            'icon-color': 'rgb(0, 146, 219)',
-            'text-color': 'rgb(0, 146, 219)',
-        },
-        {
-            filter: ['==', ['get', 'waterway'], 'lock_gate'],
-            'icon-image': 'lock_gate',
-            'icon-color': 'rgb(173, 173, 173)',
-            'text-color': 'rgb(173, 173, 173)',
-        },
-    ],
+    directives: directives,
 }
diff --git a/basemap/layers/railway/line.js b/basemap/layers/railway/line.js
index 874f1475..fb2544b0 100644
--- a/basemap/layers/railway/line.js
+++ b/basemap/layers/railway/line.js
@@ -1,3 +1,80 @@
+import {withLineSortKey} from "../../utils/utils.js";
+
+let directive = [
+    {
+        'filter': [
+            'all',
+            ['==', ['get', 'railway'], 'rail'],
+            ['!', ['has', 'service']],
+        ],
+        'line-color': 'rgb(112,112,112)',
+        'road-width': 10,
+    },
+    {
+        'filter': ['all',
+            ['==', ['get', 'railway'], 'rail'],
+            ['has', 'service']
+        ],
+        'line-color': 'rgb(160,160,160)',
+        'road-width': 6,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'subway'],
+        'line-color': 'rgb(160,160,160)',
+        'road-width': 6,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'tram'],
+        'line-color': 'rgb(77,77,77)',
+        'road-width': 6,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'preserved'],
+        'line-color': 'rgb(220,220,220)',
+        'road-width': 6,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'funicular'],
+        'line-color': 'rgb(100,100,100)',
+        'road-width': 6,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'monorail'],
+        'line-color': 'rgb(126,126,126)',
+        'road-width': 6,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'light_rail'],
+        'line-color': 'rgb(100,100,100)',
+        'road-width': 6,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'construction'],
+        'line-color': 'rgb(170,170,170)',
+        'road-width': 6,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'abandoned'],
+        'line-color': 'rgb(100,100,100)',
+        'road-width': 2,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'disused'],
+        'line-color': 'rgb(100,100,100)',
+        'road-width': 2,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'miniature'],
+        'line-color': 'rgb(158,158,158)',
+        'road-width': 2,
+    },
+    {
+        'filter': ['==', ['get', 'railway'], 'narrow_gauge'],
+        'line-color': 'rgb(100,100,100)',
+        'road-width': 2,
+    },
+];
+
 export default {
     'id': 'railway_line',
     'source': 'baremaps',
@@ -9,78 +86,5 @@ export default {
         'line-cap': 'round',
         'line-join': 'round',
     },
-    'directives': [
-        {
-            'filter': ['==', ['get', 'railway'], 'abandoned'],
-            'line-color': 'rgb(100,100,100)',
-            'road-width': 2,
-        },
-        {
-            'filter': ['==', ['get', 'railway'], 'construction'],
-            'line-color': 'rgb(170,170,170)',
-            'road-width': 6,
-        },
-        {
-            'filter': ['==', ['get', 'railway'], 'disused'],
-            'line-color': 'rgb(100,100,100)',
-            'road-width': 2,
-        },
-        {
-            'filter': ['==', ['get', 'railway'], 'funicular'],
-            'line-color': 'rgb(100,100,100)',
-            'road-width': 6,
-        },
-        {
-            'filter': ['==', ['get', 'railway'], 'light_rail'],
-            'line-color': 'rgb(100,100,100)',
-            'road-width': 6,
-        },
-        {
-            'filter': ['==', ['get', 'railway'], 'miniature'],
-            'line-color': 'rgb(158,158,158)',
-            'road-width': 2,
-        },
-        {
-            'filter': ['==', ['get', 'railway'], 'monorail'],
-            'line-color': 'rgb(126,126,126)',
-            'road-width': 6,
-        },
-        {
-            'filter': ['==', ['get', 'railway'], 'narrow_gauge'],
-            'line-color': 'rgb(100,100,100)',
-            'road-width': 2,
-        },
-        {
-            'filter': ['==', ['get', 'railway'], 'preserved'],
-            'line-color': 'rgb(220,220,220)',
-            'road-width': 6,
-        },
-        {
-            'filter': [
-                'all',
-                ['==', ['get', 'railway'], 'rail'],
-                ['!', ['has', 'service']],
-            ],
-            'line-color': 'rgb(112,112,112)',
-            'road-width': 10,
-        },
-        {
-            'filter': ['all',
-                ['==', ['get', 'railway'], 'rail'],
-                ['has', 'service']
-            ],
-            'line-color': 'rgb(160,160,160)',
-            'road-width': 6,
-        },
-        {
-            'filter': ['==', ['get', 'railway'], 'subway'],
-            'line-color': 'rgb(160,160,160)',
-            'road-width': 6,
-        },
-        {
-            'filter': ['==', ['get', 'railway'], 'tram'],
-            'line-color': 'rgb(77,77,77)',
-            'road-width': 6,
-        },
-    ]
+    'directives': directive.map(withLineSortKey),
 }
diff --git a/basemap/layers/route/style.js b/basemap/layers/route/style.js
index 78c7b6f5..c91222b1 100644
--- a/basemap/layers/route/style.js
+++ b/basemap/layers/route/style.js
@@ -1,3 +1,13 @@
+import {withLineSortKey} from "../../utils/utils.js";
+
+let directive = [
+    {
+        filter: ['==', ['get', 'route'], 'ferry'],
+        'line-color': 'rgb(112, 181, 201)',
+        'line-width': 1
+    },
+];
+
 export default {
     id: 'route_ferry',
     type: 'line',
@@ -8,11 +18,5 @@ export default {
         'line-join': 'round',
         visibility: 'visible',
     },
-    directives: [
-        {
-            filter: ['==', ['get', 'route'], 'ferry'],
-            'line-color': 'rgb(112, 181, 201)',
-            'line-width': 1
-        },
-    ],
+    directives: directive.map(withLineSortKey),
 }
diff --git a/basemap/utils/utils.js b/basemap/utils/utils.js
new file mode 100644
index 00000000..4091cac7
--- /dev/null
+++ b/basemap/utils/utils.js
@@ -0,0 +1,13 @@
+export function withFillSortKey(directive, index, array) {
+    return {
+        ...directive,
+        'fill-sort-key': array.length - index - 1,
+    }
+}
+
+export function withLineSortKey(directive, index, array) {
+    return {
+        ...directive,
+        'line-sort-key': array.length - index - 1,
+    }
+}
\ No newline at end of file

Reply via email to