Add name_en to waterway #88

pull/138/head
Lukas Martinelli 2017-01-18 15:53:24 +01:00
rodzic ef640b9d4e
commit 8e5caed2d8
2 zmienionych plików z 18 dodań i 11 usunięć

Wyświetl plik

@ -1,52 +1,55 @@
-- etldoc: ne_110m_rivers_lake_centerlines -> waterway_z3
CREATE OR REPLACE VIEW waterway_z3 AS (
SELECT geometry, 'river'::text AS class, NULL::text AS name FROM ne_110m_rivers_lake_centerlines
SELECT geometry, 'river'::text AS class, NULL::text AS name, NULL::text AS name_en
FROM ne_110m_rivers_lake_centerlines
WHERE featurecla = 'River'
);
-- etldoc: ne_50m_rivers_lake_centerlines -> waterway_z4
CREATE OR REPLACE VIEW waterway_z4 AS (
SELECT geometry, 'river'::text AS class, NULL::text AS name FROM ne_50m_rivers_lake_centerlines
SELECT geometry, 'river'::text AS class, NULL::text AS name, NULL::text AS name_en
FROM ne_50m_rivers_lake_centerlines
WHERE featurecla = 'River'
);
-- etldoc: ne_10m_rivers_lake_centerlines -> waterway_z6
CREATE OR REPLACE VIEW waterway_z6 AS (
SELECT geometry, 'river'::text AS class, NULL::text AS name FROM ne_10m_rivers_lake_centerlines
SELECT geometry, 'river'::text AS class, NULL::text AS name, NULL::text AS name_en
FROM ne_10m_rivers_lake_centerlines
WHERE featurecla = 'River'
);
-- etldoc: osm_important_waterway_linestring_gen3 -> waterway_z9
CREATE OR REPLACE VIEW waterway_z9 AS (
SELECT geometry, 'river'::text AS class, name FROM osm_important_waterway_linestring_gen3
SELECT geometry, 'river'::text AS class, name, name_en FROM osm_important_waterway_linestring_gen3
);
-- etldoc: osm_important_waterway_linestring_gen2 -> waterway_z10
CREATE OR REPLACE VIEW waterway_z10 AS (
SELECT geometry, 'river'::text AS class, name FROM osm_important_waterway_linestring_gen2
SELECT geometry, 'river'::text AS class, name, name_en FROM osm_important_waterway_linestring_gen2
);
-- etldoc:osm_important_waterway_linestring_gen1 -> waterway_z11
CREATE OR REPLACE VIEW waterway_z11 AS (
SELECT geometry, 'river'::text AS class, name FROM osm_important_waterway_linestring_gen1
SELECT geometry, 'river'::text AS class, name, name_en FROM osm_important_waterway_linestring_gen1
);
-- etldoc: osm_waterway_linestring -> waterway_z12
CREATE OR REPLACE VIEW waterway_z12 AS (
SELECT geometry, waterway AS class, name FROM osm_waterway_linestring
SELECT geometry, waterway AS class, name, name_en FROM osm_waterway_linestring
WHERE waterway IN ('river', 'canal')
);
-- etldoc: osm_waterway_linestring -> waterway_z13
CREATE OR REPLACE VIEW waterway_z13 AS (
SELECT geometry, waterway::text AS class, name FROM osm_waterway_linestring
SELECT geometry, waterway::text AS class, name, name_en FROM osm_waterway_linestring
WHERE waterway IN ('river', 'canal', 'stream', 'drain', 'ditch')
);
-- etldoc: osm_waterway_linestring -> waterway_z14
CREATE OR REPLACE VIEW waterway_z14 AS (
SELECT geometry, waterway::text AS class, name FROM osm_waterway_linestring
SELECT geometry, waterway::text AS class, name, name_en FROM osm_waterway_linestring
);
-- etldoc: layer_waterway[shape=record fillcolor=lightpink, style="rounded,filled",
@ -54,7 +57,10 @@ CREATE OR REPLACE VIEW waterway_z14 AS (
CREATE OR REPLACE FUNCTION layer_waterway(bbox geometry, zoom_level int)
RETURNS TABLE(geometry geometry, class text, name text) AS $$
SELECT geometry, class, NULLIF(name, '') AS name FROM (
SELECT geometry, class,
NULLIF(name, '') AS name,
COALESCE(NULLIF(name_en, ''), name) AS name_en
FROM (
-- etldoc: waterway_z3 -> layer_waterway:z3
SELECT * FROM waterway_z3 WHERE zoom_level = 3
UNION ALL

Wyświetl plik

@ -10,6 +10,7 @@ layer:
name: |
The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the waterway.
The `name` field may be empty for NaturalEarth data or at lower zoom levels.
name_en: The english `name:en` value if available.
class:
description: |
The original value of the [`waterway`](http://wiki.openstreetmap.org/wiki/Key:waterway) tag.
@ -21,7 +22,7 @@ layer:
- ditch
datasource:
geometry_field: geometry
query: (SELECT geometry, name, class FROM layer_waterway(!bbox!, z(!scale_denominator!))) AS t
query: (SELECT geometry, name, name_en, class FROM layer_waterway(!bbox!, z(!scale_denominator!))) AS t
schema:
- ./merge_waterway.sql
- ./waterway.sql