Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Translate more style features

Russ Garrettd9fa633ff0ac
diff --git a/web/locales/en/translation.json b/web/locales/en/translation.json
index a41cf55..dbd56f4 100644
--- a/web/locales/en/translation.json
+++ b/web/locales/en/translation.json
@@ -80,7 +80,8 @@
"fresh-water": "Fresh water",
"hot-water": "Hot water",
"steam": "Steam",
- "wastewater": "Wastewater"
+ "wastewater": "Wastewater",
+ "rainwater": "Rainwater"
},
"other-pumping-station": "Other pumping station"
},
@@ -96,7 +97,10 @@
"circuits": "Circuits",
"type": "Type",
"website": "Website",
- "view-openstreetmap": "View on OpenStreetMap"
+ "view-openstreetmap": "View on OpenStreetMap",
+ "substance": "Substance",
+ "usage": "Usage",
+ "location": "Location"
},
"nav": {
"about": "about",
diff --git a/web/src/infopopup.ts b/web/src/infopopup.ts
index ba3c3fd..ebb2e79 100644
--- a/web/src/infopopup.ts
+++ b/web/src/infopopup.ts
@@ -29,16 +29,19 @@ const hidden_keys = [
function fieldName(key: string) {
return (
{
- name: t('info.name', 'Name'),
- operator: t('info.operator', 'Operator'),
- output: t('info.output', 'Output'),
- source: t('info.source', 'Source'),
- start_date: t('info.start-date', 'Start date'),
- method: t('info.generation-method', 'Generation method'),
- substation: t('info.substation-type', 'Substation type'),
- ref: t('info.reference', 'Reference'),
- circuits: t('info.circuits', 'Circuits'),
- type: t('info.type', 'Type'),
+ name: t('info.name'),
+ operator: t('info.operator'),
+ output: t('info.output'),
+ source: t('info.source'),
+ start_date: t('info.start-date'),
+ method: t('info.generation-method'),
+ substation: t('info.substation-type'),
+ ref: t('info.reference'),
+ circuits: t('info.circuits'),
+ type: t('info.type'),
+ substance: t('info.substance'),
+ location: t('info.location'),
+ usage: t('info.usage'),
repd_id: 'REPD ID'
}[key] || titleCase(key)
)
@@ -207,7 +210,7 @@ class InfoPopup {
nameTags(feature: MapGeoJSONFeature) {
let title_text = ''
- for (const tag of local_name_tags) {
+ for (const tag of local_name_tags()) {
if (feature.properties[tag]) {
title_text = feature.properties[tag]
break
diff --git a/web/src/key/key.ts b/web/src/key/key.ts
index 3aa97f9..8504d7f 100644
--- a/web/src/key/key.ts
+++ b/web/src/key/key.ts
@@ -240,7 +240,7 @@ class KeyControl implements IControl {
async telecomTable() {
const rows = [
- [t('names.cable', 'Cable'), svgLineFromLayer(comms_layers, 'telecoms_line')],
+ [t('names.cable', 'Cable'), svgLineFromLayer(comms_layers(), 'telecoms_line')],
[t('names.telecom.tower-mast', 'Tower/Mast'), await this.sprite('comms_tower')],
[t('names.telecom.datacenter', 'Datacenter'), await this.sprite('telecom_datacenter')],
[t('names.telecom.exchange', 'Exchange'), await this.sprite('telecom_exchange')],
@@ -265,7 +265,7 @@ class KeyControl implements IControl {
[t('other', 'Other'), svgLine(colour_unknown, line_thickness)],
[
t('names.petroleum.facility', 'Petroleum facility'),
- svgRectFromLayer(petroleum_layers, 'petroleum_site')
+ svgRectFromLayer(petroleum_layers(), 'petroleum_site')
]
]
const table = list('table', Tr)
diff --git a/web/src/l10n.ts b/web/src/l10n.ts
index 9f28faf..d209440 100644
--- a/web/src/l10n.ts
+++ b/web/src/l10n.ts
@@ -7,9 +7,11 @@ import browserLanguage from 'in-browser-language'
const layer_supported_languages: string[] = ['en', 'es', 'de', 'fr', 'hi', 'ur', 'zh', 'ru', 'pt', 'ja']
/* List of name tags to check, in order */
-const local_name_tags: string[] = (browserLanguage.list() as string[])
- .filter((code: string) => layer_supported_languages.includes(code))
- .map((code: string) => `name_${code}`)
- .concat(['name'])
+function local_name_tags(): string[] {
+ return (browserLanguage.list() as string[])
+ .filter((code: string) => layer_supported_languages.includes(code))
+ .map((code: string) => `name_${code}`)
+ .concat(['name'])
+}
export { layer_supported_languages, local_name_tags }
diff --git a/web/src/openinframap.ts b/web/src/openinframap.ts
index 06e679a..0be2bc3 100644
--- a/web/src/openinframap.ts
+++ b/web/src/openinframap.ts
@@ -69,9 +69,9 @@ export default class OpenInfraMap {
const oim_layers: LayerSpecificationWithZIndex[] = [
...style_oim_power(),
...style_oim_power_heatmap,
- ...style_oim_petroleum,
- ...style_oim_telecoms,
- ...style_oim_water
+ ...style_oim_petroleum(),
+ ...style_oim_telecoms(),
+ ...style_oim_water()
]
oim_layers.sort((a, b) => {
diff --git a/web/src/style/common.ts b/web/src/style/common.ts
index 34caf2b..b8dfc19 100644
--- a/web/src/style/common.ts
+++ b/web/src/style/common.ts
@@ -3,9 +3,9 @@ import { LayerSpecificationWithZIndex } from './types.ts'
import { local_name_tags } from '../l10n.ts'
import { step, interpolate, literal, get, has, all, any, concat } from './stylehelpers.ts'
-export const local_name: ExpressionSpecification = (['coalesce'] as any).concat(
- local_name_tags.map((tag) => get(tag))
-) as ExpressionSpecification
+export function get_local_name(): ExpressionSpecification {
+ return (['coalesce'] as any).concat(local_name_tags().map((tag) => get(tag))) as ExpressionSpecification
+}
export const text_paint = {
'text-halo-width': 4,
diff --git a/web/src/style/style_oim_petroleum.ts b/web/src/style/style_oim_petroleum.ts
index bbd6d68..ce15e56 100644
--- a/web/src/style/style_oim_petroleum.ts
+++ b/web/src/style/style_oim_petroleum.ts
@@ -1,5 +1,6 @@
+import { t } from 'i18next'
import { ColorSpecification, ExpressionSpecification } from 'maplibre-gl'
-import { text_paint, font } from './common.js'
+import { text_paint, font, get_local_name } from './common.js'
import { LayerSpecificationWithZIndex } from './types.ts'
import { interpolate, match, coalesce, get, has, concat, if_, zoom, any, all } from './stylehelpers.ts'
@@ -26,131 +27,156 @@ const pipeline_colour: ExpressionSpecification = match(
colour_unknown
)
-const pipeline_label: ExpressionSpecification = concat(
- if_(has('name'), get('name'), get('operator')),
- if_(all(['!=', substance, ''], any(has('operator'), has('name'))), concat(' (', substance, ')'), substance)
-)
+function substance_label(): ExpressionSpecification {
+ return match(
+ get('substance'),
+ [
+ [['gas', 'natural_gas', 'cng', 'lpg', 'lng'], t('names.substance.gas')],
+ ['oil', t('names.substance.oil')],
+ ['fuel', t('names.substance.fuel')],
+ [
+ ['ngl', 'y-grade', 'hydrocarbons', 'condensate', 'naphtha'],
+ t('names.substance.petroleum-intermediate')
+ ],
+ ['hydrogen', t('names.substance.hydrogen')],
+ ['carbon_dioxide', t('names.substance.co2')]
+ ],
+ get('substance')
+ )
+}
+
+function pipeline_label(): ExpressionSpecification {
+ return concat(
+ if_(has('name'), get('name'), get('operator')),
+ if_(
+ all(['!=', get('substance'), ''], any(has('operator'), has('name'))),
+ concat(' (', substance_label(), ')'),
+ substance_label()
+ )
+ )
+}
-const layers: LayerSpecificationWithZIndex[] = [
- {
- zorder: 1,
- id: 'petroleum_pipeline_case',
- type: 'line',
- source: 'petroleum',
- minzoom: 7,
- 'source-layer': 'petroleum_pipeline',
- paint: {
- 'line-color': '#666666',
- 'line-width': interpolate(zoom, [
- [8, 1.5],
- [16, ['match', get('usage'), 'transmission', 4, 1.5]]
- ])
+export default function layers(): LayerSpecificationWithZIndex[] {
+ return [
+ {
+ zorder: 1,
+ id: 'petroleum_pipeline_case',
+ type: 'line',
+ source: 'petroleum',
+ minzoom: 7,
+ 'source-layer': 'petroleum_pipeline',
+ paint: {
+ 'line-color': '#666666',
+ 'line-width': interpolate(zoom, [
+ [8, 1.5],
+ [16, ['match', get('usage'), 'transmission', 4, 1.5]]
+ ])
+ },
+ layout: {
+ 'line-cap': 'round',
+ 'line-join': 'round'
+ }
},
- layout: {
- 'line-cap': 'round',
- 'line-join': 'round'
- }
- },
- {
- zorder: 2,
- id: 'petroleum_pipeline',
- type: 'line',
- source: 'petroleum',
- minzoom: 2,
- 'source-layer': 'petroleum_pipeline',
- paint: {
- 'line-color': pipeline_colour,
- 'line-width': interpolate(zoom, [
- [3, 1],
- [16, ['match', get('usage'), 'transmission', 2, 1]]
- ])
- }
- },
- {
- zorder: 100,
- id: 'petroleum_site',
- type: 'fill',
- source: 'petroleum',
- minzoom: 8,
- 'source-layer': 'petroleum_site',
- paint: {
- 'fill-opacity': 0.3,
- 'fill-color': colour_oil,
- 'fill-outline-color': 'rgba(0, 0, 0, 1)'
- }
- },
- {
- zorder: 101,
- id: 'petroleum_well',
- type: 'circle',
- source: 'petroleum',
- minzoom: 10,
- 'source-layer': 'petroleum_well',
- paint: {
- 'circle-color': colour_oil,
- 'circle-stroke-color': '#666666',
- 'circle-stroke-width': 1,
- 'circle-radius': interpolate(zoom, [
- [10, 1],
- [12, 2],
- [14, 5]
- ])
- }
- },
- {
- zorder: 500,
- id: 'petroleum_pipeline_label',
- type: 'symbol',
- source: 'petroleum',
- 'source-layer': 'petroleum_pipeline',
- minzoom: 12,
- paint: text_paint,
- layout: {
- 'text-field': pipeline_label,
- 'text-font': font,
- 'symbol-placement': 'line',
- 'symbol-spacing': 400,
- 'text-size': 10,
- 'text-offset': [0, 1],
- 'text-max-angle': 10
- }
- },
- {
- zorder: 501,
- id: 'petroleum_site_label',
- type: 'symbol',
- source: 'petroleum',
- 'source-layer': 'petroleum_site',
- minzoom: 12,
- layout: {
- 'text-field': '{name}',
- 'text-font': font,
- 'text-anchor': 'top',
- 'text-offset': [0, 1],
- 'text-size': 11
+ {
+ zorder: 2,
+ id: 'petroleum_pipeline',
+ type: 'line',
+ source: 'petroleum',
+ minzoom: 2,
+ 'source-layer': 'petroleum_pipeline',
+ paint: {
+ 'line-color': pipeline_colour,
+ 'line-width': interpolate(zoom, [
+ [3, 1],
+ [16, ['match', get('usage'), 'transmission', 2, 1]]
+ ])
+ }
+ },
+ {
+ zorder: 100,
+ id: 'petroleum_site',
+ type: 'fill',
+ source: 'petroleum',
+ minzoom: 8,
+ 'source-layer': 'petroleum_site',
+ paint: {
+ 'fill-opacity': 0.3,
+ 'fill-color': colour_oil,
+ 'fill-outline-color': 'rgba(0, 0, 0, 1)'
+ }
+ },
+ {
+ zorder: 101,
+ id: 'petroleum_well',
+ type: 'circle',
+ source: 'petroleum',
+ minzoom: 10,
+ 'source-layer': 'petroleum_well',
+ paint: {
+ 'circle-color': colour_oil,
+ 'circle-stroke-color': '#666666',
+ 'circle-stroke-width': 1,
+ 'circle-radius': interpolate(zoom, [
+ [10, 1],
+ [12, 2],
+ [14, 5]
+ ])
+ }
},
- paint: text_paint
- },
- {
- zorder: 502,
- id: 'petroleum_well_label',
- type: 'symbol',
- source: 'petroleum',
- 'source-layer': 'petroleum_well',
- minzoom: 13,
- layout: {
- 'text-field': 'Well {name}',
- 'text-font': font,
- 'text-anchor': 'top',
- 'text-offset': [0, 0.5],
- 'text-size': 10
+ {
+ zorder: 500,
+ id: 'petroleum_pipeline_label',
+ type: 'symbol',
+ source: 'petroleum',
+ 'source-layer': 'petroleum_pipeline',
+ minzoom: 12,
+ paint: text_paint,
+ layout: {
+ 'text-field': pipeline_label(),
+ 'text-font': font,
+ 'symbol-placement': 'line',
+ 'symbol-spacing': 400,
+ 'text-size': 10,
+ 'text-offset': [0, 1],
+ 'text-max-angle': 10
+ }
},
- paint: text_paint
- }
-]
+ {
+ zorder: 501,
+ id: 'petroleum_site_label',
+ type: 'symbol',
+ source: 'petroleum',
+ 'source-layer': 'petroleum_site',
+ minzoom: 12,
+ layout: {
+ 'text-field': get_local_name(),
+ 'text-font': font,
+ 'text-anchor': 'top',
+ 'text-offset': [0, 1],
+ 'text-size': 11
+ },
+ paint: text_paint
+ },
+ {
+ zorder: 502,
+ id: 'petroleum_well_label',
+ type: 'symbol',
+ source: 'petroleum',
+ 'source-layer': 'petroleum_well',
+ minzoom: 13,
+ layout: {
+ 'text-field': concat(t('names.petroleum.well'), ' ', get_local_name()),
+ 'text-font': font,
+ 'text-anchor': 'top',
+ 'text-offset': [0, 0.5],
+ 'text-size': 10
+ },
+ paint: text_paint
+ }
+ ]
+}
export {
- layers as default,
colour_gas,
colour_oil,
colour_fuel,
diff --git a/web/src/style/style_oim_power.ts b/web/src/style/style_oim_power.ts
index dbf920e..4d36999 100644
--- a/web/src/style/style_oim_power.ts
+++ b/web/src/style/style_oim_power.ts
@@ -1,5 +1,5 @@
import { t } from 'i18next'
-import { text_paint, underground_p, font, local_name, oimSymbol } from './common.js'
+import { text_paint, underground_p, font, get_local_name, oimSymbol } from './common.js'
import {
all,
has,
@@ -271,6 +271,8 @@ export default function layers(): LayerSpecificationWithZIndex[] {
concat(['round', ['*', output, 1000]], ' ' + t('units.kW', 'kW'))
)
+ const local_name = get_local_name()
+
function name_output_label(detail_zoom: number) {
return step(zoom, local_name, [
[
diff --git a/web/src/style/style_oim_telecoms.ts b/web/src/style/style_oim_telecoms.ts
index 75d3661..2fbebe2 100644
--- a/web/src/style/style_oim_telecoms.ts
+++ b/web/src/style/style_oim_telecoms.ts
@@ -1,106 +1,106 @@
import { LayerSpecificationWithZIndex } from './types.ts'
import { text_paint, operator_text, font, oimSymbol } from './common.js'
-import { local_name } from './common.ts'
+import { get_local_name } from './common.ts'
import { interpolate, rgb, zoom } from './stylehelpers.ts'
-const layers: LayerSpecificationWithZIndex[] = [
- {
- zorder: 40,
- id: 'telecoms_line',
- type: 'line',
- source: 'telecoms',
- minzoom: 2,
- 'source-layer': 'telecoms_communication_line',
- paint: {
- 'line-color': '#61637A',
- 'line-width': interpolate(zoom, [
- [3, 0.3],
- [11, 2]
- ]),
- 'line-dasharray': [3, 2]
+export default function layers(): LayerSpecificationWithZIndex[] {
+ return [
+ {
+ zorder: 40,
+ id: 'telecoms_line',
+ type: 'line',
+ source: 'telecoms',
+ minzoom: 2,
+ 'source-layer': 'telecoms_communication_line',
+ paint: {
+ 'line-color': '#61637A',
+ 'line-width': interpolate(zoom, [
+ [3, 0.3],
+ [11, 2]
+ ]),
+ 'line-dasharray': [3, 2]
+ }
+ },
+ {
+ zorder: 140,
+ id: 'telecoms_data_center',
+ type: 'fill',
+ source: 'telecoms',
+ minzoom: 10,
+ 'source-layer': 'telecoms_data_center',
+ paint: {
+ 'fill-opacity': 0.3,
+ 'fill-color': '#7D59AB',
+ 'fill-outline-color': rgb(0, 0, 0)
+ }
+ },
+ oimSymbol({
+ zorder: 560,
+ id: 'telecoms_cabinet',
+ source: 'telecoms',
+ sourceLayer: 'telecoms_cabinet',
+ minZoom: 14,
+ textField: operator_text,
+ iconImage: 'cabinet',
+ iconScale: 0.4,
+ textMinZoom: 16
+ }),
+ oimSymbol({
+ zorder: 561,
+ id: 'telecoms_mast',
+ source: 'telecoms',
+ sourceLayer: 'telecoms_mast',
+ minZoom: 10,
+ textField: operator_text,
+ iconImage: 'comms_tower',
+ iconMaxZoom: 21,
+ textMinZoom: 12,
+ textOffset: 1.5
+ }),
+ oimSymbol({
+ zorder: 562,
+ id: 'telecoms_exchange_symbol',
+ source: 'telecoms',
+ sourceLayer: 'telecoms_data_center_point',
+ filter: ['in', 'type', 'exchange', 'telephone_office', 'telephone_exchange', 'central_office'],
+ minZoom: 6,
+ textField: operator_text,
+ iconImage: 'telecom_exchange',
+ iconScale: 0.2,
+ textMinZoom: 11.5,
+ iconMaxZoom: 13.5
+ }),
+ oimSymbol({
+ zorder: 563,
+ id: 'telecoms_data_center_symbol',
+ source: 'telecoms',
+ sourceLayer: 'telecoms_data_center_point',
+ filter: ['in', 'type', 'data_center', 'data_centre'],
+ minZoom: 5,
+ textField: operator_text,
+ iconImage: 'telecom_datacenter',
+ iconScale: 0.3,
+ textMinZoom: 8,
+ iconMaxZoom: 13.5,
+ textOffset: 1.9
+ }),
+ {
+ zorder: 564,
+ id: 'telecoms_line_label',
+ type: 'symbol',
+ source: 'telecoms',
+ minzoom: 9,
+ 'source-layer': 'telecoms_communication_line',
+ paint: text_paint,
+ layout: {
+ 'text-field': get_local_name(),
+ 'text-font': font,
+ 'symbol-placement': 'line',
+ 'symbol-spacing': 400,
+ 'text-size': 10,
+ 'text-offset': [0, 1],
+ 'text-max-angle': 10
+ }
}
- },
- {
- zorder: 140,
- id: 'telecoms_data_center',
- type: 'fill',
- source: 'telecoms',
- minzoom: 10,
- 'source-layer': 'telecoms_data_center',
- paint: {
- 'fill-opacity': 0.3,
- 'fill-color': '#7D59AB',
- 'fill-outline-color': rgb(0, 0, 0)
- }
- },
- oimSymbol({
- zorder: 560,
- id: 'telecoms_cabinet',
- source: 'telecoms',
- sourceLayer: 'telecoms_cabinet',
- minZoom: 14,
- textField: operator_text,
- iconImage: 'cabinet',
- iconScale: 0.4,
- textMinZoom: 16
- }),
- oimSymbol({
- zorder: 561,
- id: 'telecoms_mast',
- source: 'telecoms',
- sourceLayer: 'telecoms_mast',
- minZoom: 10,
- textField: operator_text,
- iconImage: 'comms_tower',
- iconMaxZoom: 21,
- textMinZoom: 12,
- textOffset: 1.5
- }),
- oimSymbol({
- zorder: 562,
- id: 'telecoms_exchange_symbol',
- source: 'telecoms',
- sourceLayer: 'telecoms_data_center_point',
- filter: ['in', 'type', 'exchange', 'telephone_office', 'telephone_exchange', 'central_office'],
- minZoom: 6,
- textField: operator_text,
- iconImage: 'telecom_exchange',
- iconScale: 0.2,
- textMinZoom: 11.5,
- iconMaxZoom: 13.5
- }),
- oimSymbol({
- zorder: 563,
- id: 'telecoms_data_center_symbol',
- source: 'telecoms',
- sourceLayer: 'telecoms_data_center_point',
- filter: ['in', 'type', 'data_center', 'data_centre'],
- minZoom: 5,
- textField: operator_text,
- iconImage: 'telecom_datacenter',
- iconScale: 0.3,
- textMinZoom: 8,
- iconMaxZoom: 13.5,
- textOffset: 1.9
- }),
- {
- zorder: 564,
- id: 'telecoms_line_label',
- type: 'symbol',
- source: 'telecoms',
- minzoom: 9,
- 'source-layer': 'telecoms_communication_line',
- paint: text_paint,
- layout: {
- 'text-field': local_name,
- 'text-font': font,
- 'symbol-placement': 'line',
- 'symbol-spacing': 400,
- 'text-size': 10,
- 'text-offset': [0, 1],
- 'text-max-angle': 10
- }
- }
-]
-
-export default layers
+ ]
+}
diff --git a/web/src/style/style_oim_water.ts b/web/src/style/style_oim_water.ts
index cc6a302..e9d70a1 100644
--- a/web/src/style/style_oim_water.ts
+++ b/web/src/style/style_oim_water.ts
@@ -1,5 +1,7 @@
+import { t } from 'i18next'
import { LayerSpecificationWithZIndex } from './types.ts'
-import { text_paint, font, oimSymbol } from './common.js'
+import { get, match } from './stylehelpers.ts'
+import { text_paint, font, oimSymbol, get_local_name } from './common.js'
import { ExpressionSpecification } from 'maplibre-gl'
const colour_freshwater = '#7B7CBA'
@@ -7,45 +9,33 @@ const colour_wastewater = '#BAA87B'
const colour_hotwater = '#AD4C4C'
const colour_steam = '#7BBAAC'
-const substance_label: ExpressionSpecification = [
- 'match',
- ['get', 'substance'],
- 'water',
- 'Water',
- 'rainwater',
- 'Rainwater',
- 'hot_water',
- 'Hot Water',
- 'wastewater',
- 'Wastewater',
- 'sewage',
- 'Sewage',
- 'waterwaste',
- 'Waterwaste',
- 'steam',
- 'Steam',
- ['get', 'substance']
-]
+function substance_label(): ExpressionSpecification {
+ return match(
+ get('substance'),
+ [
+ ['water', t('names.substance.fresh-water')],
+ ['rainwater', t('names.substance.rainwater')],
+ ['hot_water', t('names.substance.hot-water')],
+ [['wastewater', 'sewage', 'waterwaste'], t('names.substance.wastewater')],
+ ['steam', t('names.substance.steam')]
+ ],
+ get('substance')
+ )
+}
-const substance_colour: ExpressionSpecification = [
- 'match',
- ['get', 'substance'],
- 'water',
- colour_freshwater,
- 'rainwater',
- colour_freshwater,
- 'hot_water',
- colour_hotwater,
- 'wastewater',
- colour_wastewater,
- 'sewage',
- colour_wastewater,
- 'waterwaste',
- colour_wastewater,
- 'steam',
- colour_steam,
+const substance_colour: ExpressionSpecification = match(
+ get('substance'),
+ [
+ ['water', colour_freshwater],
+ ['rainwater', colour_freshwater],
+ ['hot_water', colour_hotwater],
+ ['wastewater', colour_wastewater],
+ ['sewage', colour_wastewater],
+ ['waterwaste', colour_wastewater],
+ ['steam', colour_steam]
+ ],
'#7B7CBA'
-]
+)
const reservoir_colour: ExpressionSpecification = [
'match',
@@ -55,279 +45,281 @@ const reservoir_colour: ExpressionSpecification = [
'#3a85d9'
]
-const layers: LayerSpecificationWithZIndex[] = [
- {
- zorder: 19,
- id: 'water_treatment_plant',
- type: 'fill',
- source: 'water',
- minzoom: 10,
- 'source-layer': 'water_treatment_plant_polygon',
- paint: {
- 'fill-color': '#7BBAAC',
- 'fill-opacity': 0.3,
- 'fill-outline-color': 'rgba(0, 0, 0, 1)'
- }
- },
- {
- zorder: 20,
- id: 'water_treatment_plant_outline',
- type: 'line',
- source: 'water',
- minzoom: 11,
- 'source-layer': 'water_treatment_plant_polygon',
- paint: {
- 'line-color': 'rgba(0,0,30,1)',
- 'line-width': ['interpolate', ['linear'], ['zoom'], 11, 0, 18, 3]
- }
- },
- {
- zorder: 19,
- id: 'water_sewage_treatment_plant',
- type: 'fill',
- source: 'water',
- minzoom: 10,
- 'source-layer': 'wastewater_plant_polygon',
- paint: {
- 'fill-color': '#c19653',
- 'fill-opacity': 0.3,
- 'fill-outline-color': 'rgba(0, 0, 0, 1)'
- }
- },
- {
- zorder: 20,
- id: 'water_sewage_treatment_plant_outline',
- type: 'line',
- source: 'water',
- minzoom: 11,
- 'source-layer': 'wastewater_plant_polygon',
- paint: {
- 'line-color': 'rgba(0,0,30,1)',
- 'line-width': ['interpolate', ['linear'], ['zoom'], 11, 0, 18, 3]
- }
- },
- {
- zorder: 19,
- id: 'water_pumping_station',
- type: 'fill',
- source: 'water',
- minzoom: 10,
- 'source-layer': 'pumping_station_polygon',
- paint: {
- 'fill-color': '#7B7CBA',
- 'fill-opacity': 0.3,
- 'fill-outline-color': 'rgba(0, 0, 0, 1)'
- }
- },
- {
- zorder: 20,
- id: 'water_pumping_station_outline',
- type: 'line',
- source: 'water',
- minzoom: 10,
- 'source-layer': 'pumping_station_polygon',
- paint: {
- 'line-color': 'rgba(0,0,30,1)',
- 'line-width': ['interpolate', ['linear'], ['zoom'], 10, 0, 18, 3]
- }
- },
- {
- zorder: 20,
- id: 'water_reservoir',
- type: 'fill',
- source: 'water',
- minzoom: 4,
- 'source-layer': 'water_reservoir',
- paint: {
- 'fill-color': reservoir_colour
- }
- },
- {
- zorder: 21,
- id: 'water_reservoir_covered_outline',
- filter: ['==', ['get', 'type'], 'reservoir_covered'],
- type: 'line',
- source: 'water',
- minzoom: 11,
- 'source-layer': 'water_reservoir',
- paint: {
- 'line-color': 'rgba(200,200,200,1)',
- 'line-width': ['interpolate', ['linear'], ['zoom'], 11, 2, 18, 20],
- 'line-offset': ['interpolate', ['linear'], ['zoom'], 11, 1, 18, 10],
- 'line-blur': 1
- }
- },
- {
- zorder: 21,
- id: 'water_reservoir_outline',
- filter: ['!=', ['get', 'type'], 'reservoir_covered'],
- type: 'line',
- source: 'water',
- minzoom: 10,
- 'source-layer': 'water_reservoir',
- paint: {
- 'line-color': 'rgba(80,80,100,1)',
- 'line-width': ['interpolate', ['linear'], ['zoom'], 10, 0, 18, 4]
- }
- },
- {
- zorder: 20,
- id: 'water_pipeline_case',
- type: 'line',
- source: 'water',
- minzoom: 7,
- 'source-layer': 'water_pipeline',
- paint: {
- 'line-color': '#777777',
- 'line-width': [
- 'interpolate',
- ['exponential', 1.2],
- ['zoom'],
- 3,
- 1,
- 18,
- ['case', ['==', ['get', 'usage'], 'transmission'], 18, 6]
- ]
+export default function layers(): LayerSpecificationWithZIndex[] {
+ return [
+ {
+ zorder: 19,
+ id: 'water_treatment_plant',
+ type: 'fill',
+ source: 'water',
+ minzoom: 10,
+ 'source-layer': 'water_treatment_plant_polygon',
+ paint: {
+ 'fill-color': '#7BBAAC',
+ 'fill-opacity': 0.3,
+ 'fill-outline-color': 'rgba(0, 0, 0, 1)'
+ }
+ },
+ {
+ zorder: 20,
+ id: 'water_treatment_plant_outline',
+ type: 'line',
+ source: 'water',
+ minzoom: 11,
+ 'source-layer': 'water_treatment_plant_polygon',
+ paint: {
+ 'line-color': 'rgba(0,0,30,1)',
+ 'line-width': ['interpolate', ['linear'], ['zoom'], 11, 0, 18, 3]
+ }
+ },
+ {
+ zorder: 19,
+ id: 'water_sewage_treatment_plant',
+ type: 'fill',
+ source: 'water',
+ minzoom: 10,
+ 'source-layer': 'wastewater_plant_polygon',
+ paint: {
+ 'fill-color': '#c19653',
+ 'fill-opacity': 0.3,
+ 'fill-outline-color': 'rgba(0, 0, 0, 1)'
+ }
+ },
+ {
+ zorder: 20,
+ id: 'water_sewage_treatment_plant_outline',
+ type: 'line',
+ source: 'water',
+ minzoom: 11,
+ 'source-layer': 'wastewater_plant_polygon',
+ paint: {
+ 'line-color': 'rgba(0,0,30,1)',
+ 'line-width': ['interpolate', ['linear'], ['zoom'], 11, 0, 18, 3]
+ }
+ },
+ {
+ zorder: 19,
+ id: 'water_pumping_station',
+ type: 'fill',
+ source: 'water',
+ minzoom: 10,
+ 'source-layer': 'pumping_station_polygon',
+ paint: {
+ 'fill-color': '#7B7CBA',
+ 'fill-opacity': 0.3,
+ 'fill-outline-color': 'rgba(0, 0, 0, 1)'
+ }
+ },
+ {
+ zorder: 20,
+ id: 'water_pumping_station_outline',
+ type: 'line',
+ source: 'water',
+ minzoom: 10,
+ 'source-layer': 'pumping_station_polygon',
+ paint: {
+ 'line-color': 'rgba(0,0,30,1)',
+ 'line-width': ['interpolate', ['linear'], ['zoom'], 10, 0, 18, 3]
+ }
+ },
+ {
+ zorder: 20,
+ id: 'water_reservoir',
+ type: 'fill',
+ source: 'water',
+ minzoom: 4,
+ 'source-layer': 'water_reservoir',
+ paint: {
+ 'fill-color': reservoir_colour
+ }
},
- layout: {
- 'line-cap': 'round',
- 'line-join': 'round'
- }
- },
- {
- zorder: 21,
- id: 'water_pipeline',
- type: 'line',
- source: 'water',
- minzoom: 3,
- 'source-layer': 'water_pipeline',
- paint: {
- 'line-color': substance_colour,
- 'line-width': [
- 'interpolate',
- ['exponential', 1.2],
- ['zoom'],
- 3,
- 1,
- 18,
- ['case', ['==', ['get', 'usage'], 'transmission'], 10, 3]
- ]
- }
- },
- {
- zorder: 21,
- id: 'water_pressurised',
- type: 'line',
- source: 'water',
- minzoom: 3,
- 'source-layer': 'pressurised_waterway',
- paint: {
- 'line-color': substance_colour,
- 'line-width': ['interpolate', ['linear'], ['zoom'], 3, 0.3, 16, 4]
- }
- },
- {
- zorder: 30,
- id: 'water_well',
- type: 'circle',
- source: 'water',
- minzoom: 8,
- 'source-layer': 'water_well',
- paint: {
- 'circle-color': '#7B7CBA',
- 'circle-radius': ['interpolate', ['exponential', 1.2], ['zoom'], 8, 1, 19, 14],
- 'circle-stroke-color': 'rgba(0, 0, 0, 1)',
- 'circle-stroke-width': 1
- }
- },
- {
- zorder: 518,
- id: 'water_reservoir_label',
- type: 'symbol',
- source: 'water',
- 'source-layer': 'water_reservoir_point',
- minzoom: 11,
- paint: text_paint,
- layout: {
- 'text-field': ['get', 'name'],
- 'text-font': font,
- 'text-size': ['interpolate', ['linear'], ['zoom'], 11, 9, 18, 17],
- 'text-anchor': 'top',
- 'text-offset': [0, 1]
- }
- },
- {
- zorder: 519,
- id: 'water_pipeline_label',
- type: 'symbol',
- source: 'water',
- 'source-layer': 'water_pipeline',
- minzoom: 11,
- paint: text_paint,
- layout: {
- 'text-field': [
- 'case',
- ['has', 'name'],
- ['concat', ['get', 'name'], ' (', substance_label, ')'],
- substance_label
+ {
+ zorder: 21,
+ id: 'water_reservoir_covered_outline',
+ filter: ['==', ['get', 'type'], 'reservoir_covered'],
+ type: 'line',
+ source: 'water',
+ minzoom: 11,
+ 'source-layer': 'water_reservoir',
+ paint: {
+ 'line-color': 'rgba(200,200,200,1)',
+ 'line-width': ['interpolate', ['linear'], ['zoom'], 11, 2, 18, 20],
+ 'line-offset': ['interpolate', ['linear'], ['zoom'], 11, 1, 18, 10],
+ 'line-blur': 1
+ }
+ },
+ {
+ zorder: 21,
+ id: 'water_reservoir_outline',
+ filter: ['!=', ['get', 'type'], 'reservoir_covered'],
+ type: 'line',
+ source: 'water',
+ minzoom: 10,
+ 'source-layer': 'water_reservoir',
+ paint: {
+ 'line-color': 'rgba(80,80,100,1)',
+ 'line-width': ['interpolate', ['linear'], ['zoom'], 10, 0, 18, 4]
+ }
+ },
+ {
+ zorder: 20,
+ id: 'water_pipeline_case',
+ type: 'line',
+ source: 'water',
+ minzoom: 7,
+ 'source-layer': 'water_pipeline',
+ paint: {
+ 'line-color': '#777777',
+ 'line-width': [
+ 'interpolate',
+ ['exponential', 1.2],
+ ['zoom'],
+ 3,
+ 1,
+ 18,
+ ['case', ['==', ['get', 'usage'], 'transmission'], 18, 6]
+ ]
+ },
+ layout: {
+ 'line-cap': 'round',
+ 'line-join': 'round'
+ }
+ },
+ {
+ zorder: 21,
+ id: 'water_pipeline',
+ type: 'line',
+ source: 'water',
+ minzoom: 3,
+ 'source-layer': 'water_pipeline',
+ paint: {
+ 'line-color': substance_colour,
+ 'line-width': [
+ 'interpolate',
+ ['exponential', 1.2],
+ ['zoom'],
+ 3,
+ 1,
+ 18,
+ ['case', ['==', ['get', 'usage'], 'transmission'], 10, 3]
+ ]
+ }
+ },
+ {
+ zorder: 21,
+ id: 'water_pressurised',
+ type: 'line',
+ source: 'water',
+ minzoom: 3,
+ 'source-layer': 'pressurised_waterway',
+ paint: {
+ 'line-color': substance_colour,
+ 'line-width': ['interpolate', ['linear'], ['zoom'], 3, 0.3, 16, 4]
+ }
+ },
+ {
+ zorder: 30,
+ id: 'water_well',
+ type: 'circle',
+ source: 'water',
+ minzoom: 8,
+ 'source-layer': 'water_well',
+ paint: {
+ 'circle-color': '#7B7CBA',
+ 'circle-radius': ['interpolate', ['exponential', 1.2], ['zoom'], 8, 1, 19, 14],
+ 'circle-stroke-color': 'rgba(0, 0, 0, 1)',
+ 'circle-stroke-width': 1
+ }
+ },
+ {
+ zorder: 518,
+ id: 'water_reservoir_label',
+ type: 'symbol',
+ source: 'water',
+ 'source-layer': 'water_reservoir_point',
+ minzoom: 11,
+ paint: text_paint,
+ layout: {
+ 'text-field': get_local_name(),
+ 'text-font': font,
+ 'text-size': ['interpolate', ['linear'], ['zoom'], 11, 9, 18, 17],
+ 'text-anchor': 'top',
+ 'text-offset': [0, 1]
+ }
+ },
+ {
+ zorder: 519,
+ id: 'water_pipeline_label',
+ type: 'symbol',
+ source: 'water',
+ 'source-layer': 'water_pipeline',
+ minzoom: 11,
+ paint: text_paint,
+ layout: {
+ 'text-field': [
+ 'case',
+ ['has', 'name'],
+ ['concat', get_local_name(), ' (', substance_label(), ')'],
+ substance_label()
+ ],
+ 'text-font': font,
+ 'symbol-placement': 'line',
+ 'symbol-spacing': 400,
+ 'text-size': 10,
+ 'text-offset': [0, 1],
+ 'text-max-angle': 10
+ }
+ },
+ oimSymbol({
+ zorder: 520,
+ id: 'water_pumping_station_symbol',
+ source: 'water',
+ sourceLayer: 'pumping_station_point',
+ minZoom: 9,
+ textField: ['get', 'name'],
+ textMinZoom: 10,
+ iconImage: [
+ 'match',
+ ['get', 'substance'],
+ 'water',
+ 'water_pumping_station',
+ 'sewage',
+ 'sewage_pumping_station',
+ 'pumping_station'
],
- 'text-font': font,
- 'symbol-placement': 'line',
- 'symbol-spacing': 400,
- 'text-size': 10,
- 'text-offset': [0, 1],
- 'text-max-angle': 10
- }
- },
- oimSymbol({
- zorder: 520,
- id: 'water_pumping_station_symbol',
- source: 'water',
- sourceLayer: 'pumping_station_point',
- minZoom: 9,
- textField: ['get', 'name'],
- textMinZoom: 10,
- iconImage: [
- 'match',
- ['get', 'substance'],
- 'water',
- 'water_pumping_station',
- 'sewage',
- 'sewage_pumping_station',
- 'pumping_station'
- ],
- iconScale: 0.25,
- iconMinScale: 0.08,
- iconMaxZoom: 14.5
- }),
- oimSymbol({
- zorder: 521,
- id: 'water_treatment_plant_symbol',
- source: 'water',
- sourceLayer: 'water_treatment_plant_point',
- minZoom: 6,
- textField: ['get', 'name'],
- textMinZoom: 10,
- iconImage: 'water_treatment_plant',
- iconScale: 0.4,
- iconMinScale: 0.08,
- iconMaxZoom: 14.5,
- textOffset: 1.9
- }),
- oimSymbol({
- zorder: 522,
- id: 'water_sewage_treatment_plant_symbol',
- source: 'water',
- sourceLayer: 'wastewater_plant_point',
- minZoom: 6,
- textField: ['step', ['zoom'], '', 10, ['get', 'name']],
- textMinZoom: 10,
- iconImage: 'sewage_treatment_plant',
- iconScale: 0.4,
- iconMinScale: 0.08,
- iconMaxZoom: 14.5,
- textOffset: 1.9
- })
-]
+ iconScale: 0.25,
+ iconMinScale: 0.08,
+ iconMaxZoom: 14.5
+ }),
+ oimSymbol({
+ zorder: 521,
+ id: 'water_treatment_plant_symbol',
+ source: 'water',
+ sourceLayer: 'water_treatment_plant_point',
+ minZoom: 6,
+ textField: get_local_name(),
+ textMinZoom: 10,
+ iconImage: 'water_treatment_plant',
+ iconScale: 0.4,
+ iconMinScale: 0.08,
+ iconMaxZoom: 14.5,
+ textOffset: 1.9
+ }),
+ oimSymbol({
+ zorder: 522,
+ id: 'water_sewage_treatment_plant_symbol',
+ source: 'water',
+ sourceLayer: 'wastewater_plant_point',
+ minZoom: 6,
+ textField: ['step', ['zoom'], '', 10, get_local_name()],
+ textMinZoom: 10,
+ iconImage: 'sewage_treatment_plant',
+ iconScale: 0.4,
+ iconMinScale: 0.08,
+ iconMaxZoom: 14.5,
+ textOffset: 1.9
+ })
+ ]
+}
-export { layers as default, colour_freshwater, colour_wastewater, colour_hotwater, colour_steam }
+export { colour_freshwater, colour_wastewater, colour_hotwater, colour_steam }