Manage field mapping in SQL declaratively
Simplify some of the OSM->OMT field value mappings using declarative syntax. This approach is not for all cases, but in many it removes the need of storing the same field in both the .yaml and .sql files. TODO: support more complex AND/OR cases
This commit is contained in:
@@ -27,27 +27,7 @@ $$
|
||||
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
|
||||
tags,
|
||||
CASE
|
||||
WHEN aerodrome = 'international'
|
||||
OR aerodrome_type = 'international'
|
||||
THEN 'international'
|
||||
WHEN
|
||||
aerodrome = 'public'
|
||||
OR aerodrome_type LIKE '%public%'
|
||||
OR aerodrome_type = 'civil'
|
||||
THEN 'public'
|
||||
WHEN
|
||||
aerodrome = 'regional'
|
||||
OR aerodrome_type = 'regional'
|
||||
THEN 'regional'
|
||||
WHEN
|
||||
aerodrome = 'military'
|
||||
OR aerodrome_type LIKE '%military%'
|
||||
OR military = 'airfield'
|
||||
THEN 'military'
|
||||
WHEN
|
||||
aerodrome = 'private'
|
||||
OR aerodrome_type = 'private'
|
||||
THEN 'private'
|
||||
%%FIELD_MAPPING: class %%
|
||||
ELSE 'other'
|
||||
END AS class,
|
||||
NULLIF(iata, '') AS iata,
|
||||
|
||||
Reference in New Issue
Block a user