Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the generator:source tag for generator kind_detail #1865

Merged
merged 1 commit into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ One of `chain`, `gate`, `kissing_gate`, `lift_gate`, `stile`, `swing_gate`.

#### Generator `kind_detail` values:

The value of the OpenStreetMap `method` tag. Common values include `anaerobic_digestion`, `barrage`, `combustion`, `fission`, `gasification`, `photovoltaic`, `run-of-the-river`, `stream`, `thermal`, `water-pumped-storage`, `water-storage`, `wind_turbine`.
The value of the OpenStreetMap `generator:source` tag or, if that tag is missing, an interpolation from the `generator:method` tag. Common values include `biofuel`, `biogas`, `biomass`, `coal`, `diesel`, `gas`, `geothermal`, `hydro`, `nuclear`, `oil`, `solar`, `waste`, `wind`.

#### Mooring `kind_detail` values:

Expand Down
34 changes: 17 additions & 17 deletions integration-test/1424-add-new-kinds-for-hot-icon-support.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def test_photovoltaic_generator_node(self):
z, x, y, 'pois', {
'id': 3674184625,
'kind': u'generator',
'kind_detail': u'photovoltaic',
'kind_detail': u'solar',
})

def test_wind_turbine_generator_node(self):
Expand All @@ -566,7 +566,7 @@ def test_wind_turbine_generator_node(self):
z, x, y, 'pois', {
'id': 3601278314,
'kind': u'generator',
'kind_detail': u'wind_turbine',
'kind_detail': u'wind',
})

def test_combustion_generator_node(self):
Expand All @@ -590,7 +590,7 @@ def test_combustion_generator_node(self):
z, x, y, 'pois', {
'id': 3671190948,
'kind': u'generator',
'kind_detail': u'combustion',
'kind_detail': u'gas',
})

def test_runoftheriver_generator_node(self):
Expand All @@ -612,7 +612,7 @@ def test_runoftheriver_generator_node(self):
z, x, y, 'pois', {
'id': 4728106977,
'kind': u'generator',
'kind_detail': u'run-of-the-river',
'kind_detail': u'hydro',
})

def test_waterstorage_generator_node(self):
Expand All @@ -639,7 +639,7 @@ def test_waterstorage_generator_node(self):
z, x, y, 'pois', {
'id': 2363460494,
'kind': u'generator',
'kind_detail': u'water-storage',
'kind_detail': u'hydro',
})

def test_thermal_generator_node(self):
Expand All @@ -664,7 +664,7 @@ def test_thermal_generator_node(self):
z, x, y, 'pois', {
'id': 5265052918,
'kind': u'generator',
'kind_detail': u'thermal',
'kind_detail': u'solar',
})

def test_anaerobic_digestion_generator_node(self):
Expand All @@ -686,7 +686,7 @@ def test_anaerobic_digestion_generator_node(self):
z, x, y, 'pois', {
'id': 5691734305,
'kind': u'generator',
'kind_detail': u'anaerobic_digestion',
'kind_detail': u'biomass',
})

def test_fission_generator_node(self):
Expand Down Expand Up @@ -716,7 +716,7 @@ def test_fission_generator_node(self):
z, x, y, 'pois', {
'id': 33180844,
'kind': u'generator',
'kind_detail': u'fission',
'kind_detail': u'nuclear',
})

def test_gasification_generator_node(self):
Expand Down Expand Up @@ -745,7 +745,7 @@ def test_gasification_generator_node(self):
z, x, y, 'pois', {
'id': 1695449375,
'kind': u'generator',
'kind_detail': u'gasification',
'kind_detail': u'diesel',
})

def test_dam_generator_node(self):
Expand All @@ -772,7 +772,7 @@ def test_dam_generator_node(self):
z, x, y, 'pois', {
'id': 5427396488,
'kind': u'generator',
'kind_detail': u'water-storage',
'kind_detail': u'hydro',
})

def test_waterpumpedstorage_generator_node(self):
Expand All @@ -795,7 +795,7 @@ def test_waterpumpedstorage_generator_node(self):
z, x, y, 'pois', {
'id': 1567492845,
'kind': u'generator',
'kind_detail': u'water-pumped-storage',
'kind_detail': u'hydro',
})

def test_solar_photovoltaic_panel_generator_node(self):
Expand All @@ -818,7 +818,7 @@ def test_solar_photovoltaic_panel_generator_node(self):
z, x, y, 'pois', {
'id': 4029169257,
'kind': u'generator',
'kind_detail': u'photovoltaic',
'kind_detail': u'solar',
})

def test_wind_generator_node(self):
Expand All @@ -845,7 +845,7 @@ def test_wind_generator_node(self):
z, x, y, 'pois', {
'id': 3556714052,
'kind': u'generator',
'kind_detail': u'wind_turbine',
'kind_detail': u'wind',
})

def test_stream_generator_node(self):
Expand All @@ -871,7 +871,7 @@ def test_stream_generator_node(self):
z, x, y, 'pois', {
'id': 4277423725,
'kind': u'generator',
'kind_detail': u'stream',
'kind_detail': u'tidal',
})

def test_barrage_generator_node(self):
Expand Down Expand Up @@ -899,7 +899,7 @@ def test_barrage_generator_node(self):
z, x, y, 'pois', {
'id': 1321199509,
'kind': u'generator',
'kind_detail': u'barrage',
'kind_detail': u'tidal',
})

def test_solar_generator_way(self):
Expand All @@ -922,7 +922,7 @@ def test_solar_generator_way(self):
z, x, y, 'pois', {
'id': 542100951,
'kind': u'generator',
'kind_detail': u'photovoltaic',
'kind_detail': u'solar',
})

def test_photovoltaik_generator_way(self):
Expand All @@ -947,7 +947,7 @@ def test_photovoltaik_generator_way(self):
z, x, y, 'pois', {
'id': 538293962,
'kind': u'generator',
'kind_detail': u'photovoltaic',
'kind_detail': u'solar',
})

def test_money_transfer_node(self):
Expand Down
75 changes: 75 additions & 0 deletions integration-test/1578-generator-kind-detail.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# -*- encoding: utf-8 -*-
from . import FixtureTest


class GeneratorTest(FixtureTest):

def test_nuclear_generator(self):
import dsl

z, x, y = (16, 32942, 21964)

self.generate_fixtures(
# https://www.openstreetmap.org/node/2697712892
dsl.point(2697712892, (0.9602262, 50.9137851), {
'generator:output:electricity': u'600 MW',
'generator:source': u'nuclear',
'generator:type': u'AGR',
'name': u'Dungeness B Reactor 2',
'power': u'generator',
'source': u'openstreetmap.org',
}),
)

self.assert_has_feature(
z, x, y, 'pois', {
'id': 2697712892,
'kind': u'generator',
'kind_detail': u'nuclear',
})

def test_wind_generator(self):
import dsl

z, x, y = (16, 32817, 21990)

self.generate_fixtures(
# https://www.openstreetmap.org/node/4640594887
dsl.point(4640594887, (0.2736757, 50.8255855), {
'description': u'Shepham wind farm (Mid)',
'generator:method': u'wind_turbine',
'generator:source': u'wind',
'note': u'Approximate location',
'power': u'generator',
'source': u'openstreetmap.org',
}),
)

self.assert_has_feature(
z, x, y, 'pois', {
'id': 4640594887,
'kind': u'generator',
'kind_detail': u'wind',
})

def test_solar_generator(self):
import dsl

z, x, y = (16, 32892, 21451)

self.generate_fixtures(
# https://www.openstreetmap.org/node/3704770949
dsl.point(3704770949, (0.6836448, 52.6564959), {
'generator:source': u'solar',
'operator': u'Ecotricity',
'power': u'generator',
'source': u'openstreetmap.org',
}),
)

self.assert_has_feature(
z, x, y, 'pois', {
'id': 3704770949,
'kind': u'generator',
'kind_detail': u'solar',
})
1 change: 1 addition & 0 deletions scripts/mktest.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def node_test(args):
node_id=args.node_id,
node_tags=node_tags,
expect=expect,
layer_name=args.layer_name,
)

output = _render_template('node_test', args)
Expand Down
63 changes: 56 additions & 7 deletions yaml/pois.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -926,28 +926,77 @@ filters:
kind_detail:
case:
# whitelist common values
- when:
'generator:source':
- wind
- solar
- hydro
- oil
- gas
- coal
- biomass
- biogas
- diesel
- nuclear
- biofuel
- geothermal
- waste
then: {col: 'generator:source'}
- when:
'generator:source':
# remap photovoltaic -> solar, unless i'm missing something,
# it's just a more specific way of saying the same thing.
- photovoltaic
# https://wiki.openstreetmap.org/wiki/Tag%3Agenerator%3Amethod%3Dthermal
- thermal
then: solar
# backfill with previously supported values
- when:
'generator:method':
# https://wiki.openstreetmap.org/wiki/Tag%3Agenerator%3Amethod%3Danaerobic_digestion
- anaerobic_digestion
then: biomass
- when:
'generator:method':
# https://wiki.openstreetmap.org/wiki/Tag%3Agenerator%3Amethod%3Dbarrage
- barrage
- combustion
# https://wiki.openstreetmap.org/wiki/Tag%3Agenerator%3Amethod%3Dstream
- stream
then: tidal
# combustion - can't map; too generic!
- when:
'generator:method':
- fission
then: nuclear
- when:
'generator:method':
# https://wiki.openstreetmap.org/wiki/Tag%3Agenerator%3Amethod%3Dgasification
- gasification
then: biomass # or waste, but biomass is the more common tag
- when:
'generator:method':
- photovoltaic
then: solar
- when:
'generator:method':
# https://wiki.openstreetmap.org/wiki/Tag%3Agenerator%3Amethod%3Drun-of-the-river
- run-of-the-river
- stream
- thermal
# https://wiki.openstreetmap.org/wiki/Tag%3Agenerator%3Amethod%3Dwater-pumped-storage
- water-pumped-storage
# https://wiki.openstreetmap.org/wiki/Tag%3Agenerator%3Amethod%3Dwater-storage
- water-storage
then: hydro
- when:
'generator:method':
- wind_turbine
then: {col: 'generator:method'}
then: wind
# fix up some common misspellings and alternative tag uses.
- when: {'generator:method': dam}
then: water-storage
then: hydro
- when: {'generator:method': [solar, solar_photovoltaic_panel, photovoltaik, solar_panel]}
then: photovoltaic
then: solar
- when: {'generator:method': wind}
then: wind_turbine
then: wind
tier: 4
# golf_course
- filter: {leisure: golf_course}
Expand Down