adding customary_ft for peaks in US (#1298)

Add tagging that will mark unit that is customary in the country. US peaks will include the tag `customary_ft=1`.
pull/1290/head^2
Eva Jelinkova 2021-11-15 16:55:35 +01:00 zatwierdzone przez GitHub
rodzic d7ea45349e
commit 93d57a8d03
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 42 dodań i 13 usunięć

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 29 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 46 KiB

Wyświetl plik

@ -1,3 +1,22 @@
-- etldoc: osm_peak_point -> peak_point
-- etldoc: ne_10m_admin_0_countries -> peak_point
CREATE OR REPLACE VIEW peak_point AS
(
SELECT pp.osm_id,
pp.geometry,
pp.name,
pp.name_en,
pp.name_de,
pp.tags,
pp.ele,
ne.iso_a2,
pp.wikipedia
FROM osm_peak_point pp, ne_10m_admin_0_countries ne
WHERE ST_Intersects(pp.geometry, ne.geometry)
);
-- etldoc: layer_mountain_peak[shape=record fillcolor=lightpink,
-- etldoc: style="rounded,filled", label="layer_mountain_peak | <z7_> z7+ | <z13_> z13+" ] ;
@ -6,21 +25,22 @@ CREATE OR REPLACE FUNCTION layer_mountain_peak(bbox geometry,
pixel_width numeric)
RETURNS TABLE
(
osm_id bigint,
geometry geometry,
name text,
name_en text,
name_de text,
class text,
tags hstore,
ele int,
ele_ft int,
"rank" int
osm_id bigint,
geometry geometry,
name text,
name_en text,
name_de text,
class text,
tags hstore,
ele int,
ele_ft int,
customary_ft int,
"rank" int
)
AS
$$
SELECT
-- etldoc: osm_peak_point -> layer_mountain_peak:z7_
-- etldoc: peak_point -> layer_mountain_peak:z7_
osm_id,
geometry,
name,
@ -30,6 +50,7 @@ SELECT
tags,
ele::int,
ele_ft::int,
customary_ft,
rank::int
FROM (
SELECT osm_id,
@ -40,6 +61,7 @@ FROM (
tags,
substring(ele FROM E'^(-?\\d+)(\\D|$)')::int AS ele,
round(substring(ele FROM E'^(-?\\d+)(\\D|$)')::int * 3.2808399)::int AS ele_ft,
CASE WHEN iso_a2 = 'US' THEN 1 END AS customary_ft,
row_number() OVER (
PARTITION BY LabelGrid(geometry, 100 * pixel_width)
ORDER BY (
@ -48,7 +70,7 @@ FROM (
(CASE WHEN name <> '' THEN 10000 ELSE 0 END)
) DESC
)::int AS "rank"
FROM osm_peak_point
FROM peak_point
WHERE geometry && bbox
AND ele IS NOT NULL
AND ele ~ E'^-?\\d{1,4}(\\D|$)'
@ -69,6 +91,7 @@ SELECT
tags,
NULL AS ele,
NULL AS ele_ft,
NULL AS customary_ft,
rank::int
FROM (
SELECT osm_id,

Wyświetl plik

@ -19,13 +19,19 @@ layer:
- arete
ele: Elevation (`ele`) in meters.
ele_ft: Elevation (`ele`) in feet.
customary_ft:
description: |
Value 1 for peaks in location where feet is used as customary unit (USA).
values:
- 1
- NULL
rank: Rank of the peak within one tile (starting at 1 that is the most important peak).
datasource:
geometry_field: geometry
key_field: osm_id
key_field_as_attribute: no
srid: 900913
query: (SELECT osm_id, geometry, name, name_en, name_de, {name_languages}, class, ele, ele_ft, rank FROM layer_mountain_peak(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
query: (SELECT osm_id, geometry, name, name_en, name_de, {name_languages}, class, ele, ele_ft, customary_ft, rank FROM layer_mountain_peak(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
schema:
- ./update_peak_point.sql
- ./update_mountain_linestring.sql