Open Infrastructure Map, a view of infrastructure data in OpenStreetMap
Add more gas pipeline colours based on usage, diameter and pressure
Jan Alexanderf2834cf996d4
diff --git a/tegola/layers.yml b/tegola/layers.ymlindex 78573f0..72734e9 100644--- a/tegola/layers.yml+++ b/tegola/layers.yml@@ -452,6 +452,8 @@ layers:sql: tags -> 'usage'- name: diametersql: tags -> 'diameter'+ - name: pressure+ sql: tags -> 'pressure'- name: materialsql: tags -> 'material'from: osm_pipelinediff --git a/web/src/key/key.ts b/web/src/key/key.tsindex e49fc1f..0be8246 100644--- a/web/src/key/key.ts+++ b/web/src/key/key.ts@@ -6,7 +6,12 @@ import comms_layers from '../style/style_oim_telecoms.js'import {default as petroleum_layers,colour_oil,- colour_gas,+ colour_gas_transmission_large,+ colour_gas_transmission_medium,+ colour_gas_transmission_other,+ colour_gas_pressure_high,+ colour_gas_pressure_intermediate,+ colour_gas_other,colour_fuel,colour_intermediate,colour_hydrogen@@ -111,6 +116,8 @@ class KeyControl implements IControl {mount(pane, await this.switchgearTable())pane.appendChild(el('h3', t('key.telecoms', 'Telecoms')))mount(pane, await this.telecomTable())+ pane.appendChild(el('h3', t('key.gas', 'Gas')))+ mount(pane, this.gasTable())pane.appendChild(el('h3', t('key.petroleum', 'Petroleum')))mount(pane, this.petroleumTable())pane.appendChild(el('h3', t('key.water', 'Water')))@@ -246,10 +253,41 @@ class KeyControl implements IControl {return table}+ gasTable() {+ const rows = [+ [+ `${t('names.gas.pipeline.transmission', 'Transmission')} >= DN 700`,+ svgLine(colour_gas_transmission_large, line_thickness)+ ],+ [+ `${t('names.gas.pipeline.transmission', 'Transmission')} >= DN 300`,+ svgLine(colour_gas_transmission_medium, line_thickness)+ ],+ [+ `${t('names.gas.pipeline.transmission', 'Transmission')} < DN 300`,+ svgLine(colour_gas_transmission_other, line_thickness)+ ],+ [+ `${t('names.gas.pipeline.distribution', 'Distribution')} ${t('names.gas.pipeline.pressure.high', 'High Pressure')}`,+ svgLine(colour_gas_pressure_high, line_thickness)+ ],+ [+ `${t('names.gas.pipeline.distribution', 'Distribution')} ${t('names.gas.pipeline.pressure.intermediate', 'Intermediate Pressure')}`,+ svgLine(colour_gas_pressure_intermediate, line_thickness)+ ],+ [+ `${t('names.gas.pipeline.distribution', 'Distribution')} ${t('names.gas.pipeline.pressure.low', 'Low Pressure')}`,+ svgLine(colour_gas_other, line_thickness)+ ],+ ]+ const table = list('table', Tr)+ table.update(rows)+ return table+ }+petroleumTable() {const rows = [[t('names.substance.oil', 'Oil'), svgLine(colour_oil, line_thickness)],- [t('names.substance.gas', 'Gas'), svgLine(colour_gas, line_thickness)],[t('names.substance.petroleum-intermediate', 'Petroleum intermediate'),svgLine(colour_intermediate, line_thickness)diff --git a/web/src/style/style_oim_petroleum.ts b/web/src/style/style_oim_petroleum.tsindex df655f2..e8f5a8e 100644--- a/web/src/style/style_oim_petroleum.ts+++ b/web/src/style/style_oim_petroleum.ts@@ -2,19 +2,66 @@ import { t } from 'i18next'import { ColorSpecification, ExpressionSpecification } from 'maplibre-gl'import { text_paint, font, get_local_name, substance } from './common.js'import { LayerSpecificationWithZIndex } from './types.ts'-import { interpolate, match, get, has, concat, if_, zoom, any, all } from './stylehelpers.ts'+import { interpolate, match, get, has, concat, if_, zoom, any, all, case_ } from './stylehelpers.ts'-const colour_gas: ColorSpecification = '#BFBC6B'+const colour_gas_transmission_large: ColorSpecification = '#8A3976'+const colour_gas_transmission_medium: ColorSpecification = '#E65757'+const colour_gas_transmission_other: ColorSpecification = '#EA972D'+const colour_gas_pressure_high: ColorSpecification = '#ECCD25'+const colour_gas_pressure_intermediate: ColorSpecification = '#E1DD69'+const colour_gas_other: ColorSpecification = '#BFBC6B'const colour_oil: ColorSpecification = '#6B6B6B'const colour_fuel: ColorSpecification = '#CC9F83'const colour_intermediate: ColorSpecification = '#78CC9E'const colour_hydrogen: ColorSpecification = '#CC78AB'const colour_unknown: ColorSpecification = '#BABABA'+const transmission_large_p = all(+ has('usage'),+ has('diameter'),+ ['==', get('usage'), 'transmission'],+ ['>=', ['to-number', get('diameter'), 0], 700],+);+const transmission_medium_p = all(+ has('usage'),+ has('diameter'),+ ['==', get('usage'), 'transmission'],+ ['>=', ['to-number', get('diameter'), 0], 300],+);+const transmission_p = all(+ has('usage'),+ ['==', get('usage'), 'transmission'],+);+const pressure_high_p = all(+ has('pressure'),+ any(+ ['==', get('pressure'), 'high'],+ ['>=', ['to-number', get('pressure'), 0], 1],+ ),+);+const pressure_intermediate_p = all(+ has('pressure'),+ any(+ ['==', get('pressure'), 'intermediate'],+ ['>=', ['to-number', get('pressure'), 0], 0.1],+ ),+);++const usage_diameter_pressure_colour: ExpressionSpecification = case_(+ [+ [transmission_large_p, colour_gas_transmission_large],+ [transmission_medium_p, colour_gas_transmission_medium],+ [transmission_p, colour_gas_transmission_other],+ [pressure_high_p, colour_gas_pressure_high],+ [pressure_intermediate_p, colour_gas_pressure_intermediate],+ ],+ colour_gas_other+);+const pipeline_colour: ExpressionSpecification = match(substance,[- [['gas', 'natural_gas', 'cng', 'lpg', 'lng'], colour_gas],+ [['gas', 'natural_gas', 'cng', 'lpg', 'lng'], usage_diameter_pressure_colour],['oil', colour_oil],['fuel', colour_fuel],[['ngl', 'y-grade', 'hydrocarbons', 'condensate', 'naphtha'], colour_intermediate],@@ -173,7 +220,12 @@ export default function layers(): LayerSpecificationWithZIndex[] {}export {- colour_gas,+ colour_gas_transmission_large,+ colour_gas_transmission_medium,+ colour_gas_transmission_other,+ colour_gas_pressure_high,+ colour_gas_pressure_intermediate,+ colour_gas_other,colour_oil,colour_fuel,colour_intermediate,