Add name_en to transportation_name #88

pull/138/head
Lukas Martinelli 2017-01-18 16:13:37 +01:00
rodzic 8e5caed2d8
commit 25fea38fe2
3 zmienionych plików z 10 dodań i 7 usunięć

Wyświetl plik

@ -3,8 +3,10 @@
-- etldoc: label="layer_transportation_name | <z8> z8 |<z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14_> z14+" ] ; -- etldoc: label="layer_transportation_name | <z8> z8 |<z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14_> z14+" ] ;
CREATE OR REPLACE FUNCTION layer_transportation_name(bbox geometry, zoom_level integer) CREATE OR REPLACE FUNCTION layer_transportation_name(bbox geometry, zoom_level integer)
RETURNS TABLE(osm_id bigint, geometry geometry, name text, ref text, ref_length int, network text, class text) AS $$ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, ref text, ref_length int, network text, class text) AS $$
SELECT osm_id, geometry, name, SELECT osm_id, geometry,
NULLIF(name, '') AS name,
COALESCE(NULLIF(name_en, ''), name) AS name_en,
NULLIF(ref, ''), NULLIF(LENGTH(ref), 0) AS ref_length, NULLIF(ref, ''), NULLIF(LENGTH(ref), 0) AS ref_length,
--TODO: The road network of the road is not yet implemented --TODO: The road network of the road is not yet implemented
NULL::text AS network, NULL::text AS network,

Wyświetl plik

@ -34,14 +34,14 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
FROM osm_highway_linestring FROM osm_highway_linestring
-- We only care about highways (not railways) for labeling -- We only care about highways (not railways) for labeling
WHERE (name <> '' OR ref <> '') AND NULLIF(highway, '') IS NOT NULL WHERE (name <> '' OR ref <> '') AND NULLIF(highway, '') IS NOT NULL
GROUP BY name, highway, ref GROUP BY name, name_en, highway, ref
) AS highway_union ) AS highway_union
); );
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_geometry_idx ON osm_transportation_name_linestring USING gist(geometry); CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_geometry_idx ON osm_transportation_name_linestring USING gist(geometry);
-- etldoc: osm_transportation_name_linestring -> osm_transportation_name_linestring_gen1 -- etldoc: osm_transportation_name_linestring -> osm_transportation_name_linestring_gen1
CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen1 AS ( CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen1 AS (
SELECT ST_Simplify(geometry, 50) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order SELECT ST_Simplify(geometry, 50) AS geometry, osm_id, member_osm_ids, name, name_en, ref, highway, z_order
FROM osm_transportation_name_linestring FROM osm_transportation_name_linestring
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 8000 WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 8000
); );
@ -49,7 +49,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_geometry_idx
-- etldoc: osm_transportation_name_linestring_gen1 -> osm_transportation_name_linestring_gen2 -- etldoc: osm_transportation_name_linestring_gen1 -> osm_transportation_name_linestring_gen2
CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen2 AS ( CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen2 AS (
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, member_osm_ids, name, name_en, ref, highway, z_order
FROM osm_transportation_name_linestring_gen1 FROM osm_transportation_name_linestring_gen1
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 14000 WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 14000
); );
@ -57,7 +57,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_geometry_idx
-- etldoc: osm_transportation_name_linestring_gen2 -> osm_transportation_name_linestring_gen3 -- etldoc: osm_transportation_name_linestring_gen2 -> osm_transportation_name_linestring_gen3
CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen3 AS ( CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen3 AS (
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, member_osm_ids, name, name_en, ref, highway, z_order
FROM osm_transportation_name_linestring_gen2 FROM osm_transportation_name_linestring_gen2
WHERE highway = 'motorway' AND ST_Length(geometry) > 20000 WHERE highway = 'motorway' AND ST_Length(geometry) > 20000
); );

Wyświetl plik

@ -9,6 +9,7 @@ layer:
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
fields: fields:
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Highways#Names_and_references) value of the highway. name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Highways#Names_and_references) value of the highway.
name_en: The english `name:en` value if available.
ref: The OSM [`ref`](http://wiki.openstreetmap.org/wiki/Key:ref) tag of the motorway or road. ref: The OSM [`ref`](http://wiki.openstreetmap.org/wiki/Key:ref) tag of the motorway or road.
ref_length: Length of the `ref` field. Useful for having a shield icon as background for labeling motorways. ref_length: Length of the `ref` field. Useful for having a shield icon as background for labeling motorways.
network: The OSM [`network`](http://wiki.openstreetmap.org/wiki/Key:network) tag of the road. network: The OSM [`network`](http://wiki.openstreetmap.org/wiki/Key:network) tag of the road.
@ -31,7 +32,7 @@ layer:
datasource: datasource:
geometry_field: geometry geometry_field: geometry
srid: 900913 srid: 900913
query: (SELECT geometry, name, ref, ref_length, class::text FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t query: (SELECT geometry, name, name_en, ref, ref_length, class::text FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
schema: schema:
- ./merge_highways.sql - ./merge_highways.sql
- ./layer.sql - ./layer.sql