Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Remove under-construction and disused telecoms objects

Russ Garrettcb589d28bbac
diff --git a/tegola/layers.yml b/tegola/layers.yml
index 330536f..cbb8d0d 100644
--- a/tegola/layers.yml
+++ b/tegola/layers.yml
@@ -401,7 +401,7 @@ layers:
geometry_type: Point
min_zoom: 10
id_field: osm_id
- field_sets: [geom_centroid, name, wiki, start_date]
+ field_sets: [geom_centroid, name, wiki, start_date, lifecycle]
fields:
- name: material
sql: tags -> 'material'
@@ -417,7 +417,7 @@ layers:
geometry_type: Point
min_zoom: 10
id_field: osm_id
- field_sets: [geom_centroid, name, wiki, start_date]
+ field_sets: [geom_centroid, name, wiki, start_date, lifecycle]
from: osm_telecom_antenna
where: ST_GeometryType(geometry) = 'ST_Point' AND geometry && !BBOX!
@@ -427,7 +427,7 @@ layers:
geometry_type: Point
min_zoom: 10
id_field: osm_id
- field_sets: [geom_centroid, name, wiki, start_date]
+ field_sets: [geom_centroid, name, wiki, start_date, lifecycle]
from: osm_street_cabinet
where: first_semi(utility) = 'telecom' AND geometry && !BBOX!
diff --git a/web/src/style/common.ts b/web/src/style/common.ts
index ff9e137..1a416f7 100644
--- a/web/src/style/common.ts
+++ b/web/src/style/common.ts
@@ -2,6 +2,7 @@ import { ExpressionSpecification, FilterSpecification } from 'maplibre-gl'
import { LayerSpecificationWithZIndex } from './types.ts'
import { local_name_tags } from '../l10n.ts'
import { step, interpolate, get, has, all, any, concat, case_, coalesce } from './stylehelpers.ts'
+import { t } from 'i18next'
export function get_local_name(): ExpressionSpecification {
return (['coalesce'] as any).concat(local_name_tags().map((tag) => get(tag))) as ExpressionSpecification
@@ -123,3 +124,15 @@ export function oimSymbol(options: OIMSymbolOptions): LayerSpecificationWithZInd
}
}
export const substance: ExpressionSpecification = coalesce(get('substance'), get('type'), '')
+export const construction_p: ExpressionSpecification = coalesce(get('construction'), false)
+export const disused_p: ExpressionSpecification = coalesce(get('disused'), false)
+
+export function lifecycle_label(): ExpressionSpecification {
+ return case_(
+ [
+ [construction_p, ' (' + t('construction', 'under construction') + ') '],
+ [disused_p, ' (' + t('disused', 'disused') + ') ']
+ ],
+ ''
+ )
+}
diff --git a/web/src/style/style_oim_power.ts b/web/src/style/style_oim_power.ts
index 18bfe53..e05d142 100644
--- a/web/src/style/style_oim_power.ts
+++ b/web/src/style/style_oim_power.ts
@@ -1,5 +1,14 @@
import { t } from 'i18next'
-import { text_paint, underground_p, font, get_local_name, oimSymbol } from './common.js'
+import {
+ text_paint,
+ underground_p,
+ font,
+ get_local_name,
+ oimSymbol,
+ construction_p,
+ disused_p,
+ lifecycle_label
+} from './common.js'
import {
all,
has,
@@ -234,20 +243,6 @@ const power_ref_visible_p: ExpressionSpecification = all(
any(all(['!=', get('line'), 'busbar'], ['!=', get('line'), 'bay']), ['>', zoom, 12])
)
-const construction_p: ExpressionSpecification = get('construction')
-
-const disused_p: ExpressionSpecification = coalesce(get('disused'), false)
-
-function lifecycle_label(): ExpressionSpecification {
- return case_(
- [
- [construction_p, ' (' + t('construction', 'under construction') + ') '],
- [disused_p, ' (' + t('disused', 'disused') + ') ']
- ],
- ''
- )
-}
-
const plant_label_visible_p: ExpressionSpecification = any(
['>', output, 1000],
all(['>', output, 750], ['>', zoom, 5]),
diff --git a/web/src/style/style_oim_telecoms.ts b/web/src/style/style_oim_telecoms.ts
index 2fbebe2..a3ec7c9 100644
--- a/web/src/style/style_oim_telecoms.ts
+++ b/web/src/style/style_oim_telecoms.ts
@@ -1,7 +1,7 @@
import { LayerSpecificationWithZIndex } from './types.ts'
-import { text_paint, operator_text, font, oimSymbol } from './common.js'
+import { text_paint, operator_text, font, oimSymbol, construction_p, disused_p } from './common.js'
import { get_local_name } from './common.ts'
-import { interpolate, rgb, zoom } from './stylehelpers.ts'
+import { all, get, interpolate, match, not, rgb, zoom } from './stylehelpers.ts'
export default function layers(): LayerSpecificationWithZIndex[] {
return [
@@ -11,6 +11,7 @@ export default function layers(): LayerSpecificationWithZIndex[] {
type: 'line',
source: 'telecoms',
minzoom: 2,
+ filter: all(not(construction_p), not(disused_p)),
'source-layer': 'telecoms_communication_line',
paint: {
'line-color': '#61637A',
@@ -26,6 +27,7 @@ export default function layers(): LayerSpecificationWithZIndex[] {
id: 'telecoms_data_center',
type: 'fill',
source: 'telecoms',
+ filter: all(not(construction_p), not(disused_p)),
minzoom: 10,
'source-layer': 'telecoms_data_center',
paint: {
@@ -50,6 +52,7 @@ export default function layers(): LayerSpecificationWithZIndex[] {
id: 'telecoms_mast',
source: 'telecoms',
sourceLayer: 'telecoms_mast',
+ filter: all(not(construction_p), not(disused_p)),
minZoom: 10,
textField: operator_text,
iconImage: 'comms_tower',
@@ -62,7 +65,15 @@ export default function layers(): LayerSpecificationWithZIndex[] {
id: 'telecoms_exchange_symbol',
source: 'telecoms',
sourceLayer: 'telecoms_data_center_point',
- filter: ['in', 'type', 'exchange', 'telephone_office', 'telephone_exchange', 'central_office'],
+ filter: all(
+ match(
+ get('type'),
+ [[['exchange', 'telephone_office', 'telephone_exchange', 'central_office'], true]],
+ false
+ ),
+ not(construction_p),
+ not(disused_p)
+ ),
minZoom: 6,
textField: operator_text,
iconImage: 'telecom_exchange',
@@ -75,7 +86,11 @@ export default function layers(): LayerSpecificationWithZIndex[] {
id: 'telecoms_data_center_symbol',
source: 'telecoms',
sourceLayer: 'telecoms_data_center_point',
- filter: ['in', 'type', 'data_center', 'data_centre'],
+ filter: all(
+ match(get('type'), [[['data_center', 'data_centre'], true]], false),
+ not(construction_p),
+ not(disused_p)
+ ),
minZoom: 5,
textField: operator_text,
iconImage: 'telecom_datacenter',
@@ -91,6 +106,7 @@ export default function layers(): LayerSpecificationWithZIndex[] {
source: 'telecoms',
minzoom: 9,
'source-layer': 'telecoms_communication_line',
+ filter: all(not(construction_p), not(disused_p)),
paint: text_paint,
layout: {
'text-field': get_local_name(),