kopia lustrzana https://github.com/openmaptiles/openmaptiles
Add name_en to transportation_name #88
rodzic
8e5caed2d8
commit
25fea38fe2
|
@ -3,8 +3,10 @@
|
|||
-- 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)
|
||||
RETURNS TABLE(osm_id bigint, geometry geometry, name text, ref text, ref_length int, network text, class text) AS $$
|
||||
SELECT osm_id, geometry, name,
|
||||
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,
|
||||
NULLIF(name, '') AS name,
|
||||
COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
NULLIF(ref, ''), NULLIF(LENGTH(ref), 0) AS ref_length,
|
||||
--TODO: The road network of the road is not yet implemented
|
||||
NULL::text AS network,
|
||||
|
|
|
@ -34,14 +34,14 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
|
|||
FROM osm_highway_linestring
|
||||
-- We only care about highways (not railways) for labeling
|
||||
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
|
||||
);
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
WHERE highway = 'motorway' AND ST_Length(geometry) > 20000
|
||||
);
|
||||
|
|
|
@ -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
|
||||
fields:
|
||||
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_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.
|
||||
|
@ -31,7 +32,7 @@ layer:
|
|||
datasource:
|
||||
geometry_field: geometry
|
||||
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:
|
||||
- ./merge_highways.sql
|
||||
- ./layer.sql
|
||||
|
|
Ładowanie…
Reference in New Issue