Move aboriginal lands boundaries to boundary layer (#1604)

This PR adds indigenous lands to the `boundary` layer by adding new area features for these objects, along with generalization up to z4. It borrows heavily from the technical processing chain of the `park` layer.

I added new `class`, `name`, and `name:xx` attributes to the boundary layer, in order to support the new area features. Should we (or someone extending this schema) come up with new objects to place in the boundary layer in the future, `class` would support additional categories.
pull/1576/head^2
Brian Sperlongano 2024-01-21 04:37:02 -05:00 zatwierdzone przez GitHub
rodzic eb7f6be455
commit e29827d76c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
14 zmienionych plików z 492 dodań i 26 usunięć

Wyświetl plik

@ -632,7 +632,7 @@ FROM osm_border_linestring_gen_z13
);
-- etldoc: layer_boundary[shape=record fillcolor=lightpink, style="rounded,filled",
-- etldoc: label="<sql> layer_boundary |<z0> z0 |<z1> z1 |<z2> z2 | <z3> z3 | <z4> z4 | <z5> z5 | <z6> z6 | <z7> z7 | <z8> z8 | <z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13+"]
-- etldoc: label="<sql> layer_boundary |<z0> z0 |<z1> z1 |<z2> z2 | <z3> z3 | <z4> z4 | <z5> z5 | <z6> z6 | <z7> z7 | <z8> z8 | <z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14> z14+"]
CREATE OR REPLACE FUNCTION layer_boundary(bbox geometry, zoom_level int)
RETURNS TABLE
(
@ -643,11 +643,14 @@ CREATE OR REPLACE FUNCTION layer_boundary(bbox geometry, zoom_level int)
disputed int,
disputed_name text,
claimed_by text,
maritime int
maritime int,
class text,
name text,
tags hstore
)
AS
$$
SELECT geometry, admin_level, adm0_l, adm0_r, disputed::int, disputed_name, claimed_by, maritime::int
SELECT geometry, admin_level, adm0_l, adm0_r, disputed::int, disputed_name, claimed_by, maritime::int, NULL::text, NULL::text, NULL::hstore
FROM (
-- etldoc: boundary_z0 -> layer_boundary:z0
SELECT *
@ -732,7 +735,134 @@ FROM (
FROM boundary_z13
WHERE geometry && bbox
AND zoom_level >= 13
) AS zoom_levels;
) AS segment_zoom_levels
UNION ALL
SELECT geometry, NULL::int, NULL::text, NULL::text, NULL::int, NULL::text, NULL::text, NULL::int, class, name, tags
FROM (
-- etldoc: osm_boundary_polygon_gen_z4 -> layer_boundary:z4
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z4
WHERE zoom_level = 4
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z5 -> layer_boundary:z5
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z5
WHERE zoom_level = 5
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z6 -> layer_boundary:z6
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z6
WHERE zoom_level = 6
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z7 -> layer_boundary:z7
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z7
WHERE zoom_level = 7
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z8 -> layer_boundary:z8
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z8
WHERE zoom_level = 8
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z9 -> layer_boundary:z9
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z9
WHERE zoom_level = 9
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z10 -> layer_boundary:z10
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z10
WHERE zoom_level = 10
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z11 -> layer_boundary:z11
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z11
WHERE zoom_level = 11
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z12 -> layer_boundary:z12
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z12
WHERE zoom_level = 12
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon_gen_z13 -> layer_boundary:z13
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon_gen_z13
WHERE zoom_level = 13
AND geometry && bbox
UNION ALL
-- etldoc: osm_boundary_polygon -> layer_boundary:z14
SELECT geometry,
boundary AS class,
name,
tags
FROM osm_boundary_polygon
WHERE zoom_level = 14
AND geometry && bbox
) AS area_zoom_levels
$$ LANGUAGE SQL STABLE
-- STRICT
PARALLEL SAFE;

Wyświetl plik

@ -9,13 +9,17 @@ layer:
- ne_50m_admin_0_boundary_lines_land
- ne_110m_admin_0_boundary_lines_land
description: |
Contains administrative boundaries as linestrings.
Contains administrative boundaries as linestrings and aboriginal lands as polygons.
Until z4 [Natural Earth data](http://www.naturalearthdata.com/downloads/) is used after which
OSM boundaries ([`boundary=administrative`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative))
are present from z5 to z14 (also for maritime boundaries with `admin_level <= 2` at z4).
OSM data contains several [`admin_level`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level)
but for most styles it makes sense to just style `admin_level=2` and `admin_level=4`.
fields:
class:
description: |
Use the **class** to differentiate between different kinds of boundaries. The class for `boundary=aboriginal_lands` is `aboriginal_lands`.
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value (area features only).
admin_level: |
OSM [admin_level](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level)
indicating the level of importance of this boundary.
@ -58,8 +62,9 @@ layer:
buffer_size: 4
datasource:
geometry_field: geometry
query: (SELECT geometry, admin_level, adm0_l, adm0_r, disputed, disputed_name, claimed_by, maritime FROM layer_boundary(!bbox!, z(!scale_denominator!))) AS t
query: (SELECT geometry, admin_level, adm0_l, adm0_r, disputed, disputed_name, claimed_by, maritime, class, name, {name_languages} FROM layer_boundary(!bbox!, z(!scale_denominator!))) AS t
schema:
- ./update_boundary_polygon.sql
- ./boundary_name.sql
- ./boundary.sql
datasources:

Plik binarny nie jest wyświetlany.

Przed

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

Po

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

Wyświetl plik

@ -4,6 +4,67 @@ generalized_tables:
source: border_linestring
sql_filter: ST_GeometryType(geometry) = 'ST_LineString' AND (disputed OR dispute OR border_status = 'disputed' OR disputed_by <> '') AND admin_level = 2
# etldoc: osm_boundary_polygon_gen_z5 -> osm_boundary_polygon_gen_z4
boundary_polygon_gen_z4:
source: boundary_polygon_gen_z5
sql_filter: area>power(ZRES3,2)
tolerance: ZRES4
# etldoc: osm_boundary_polygon_gen_z6 -> osm_boundary_polygon_gen_z5
boundary_polygon_gen_z5:
source: boundary_polygon_gen_z6
sql_filter: area>power(ZRES4,2)
tolerance: ZRES5
# etldoc: osm_boundary_polygon_gen_z7 -> osm_boundary_polygon_gen_z6
boundary_polygon_gen_z6:
source: boundary_polygon_gen_z7
sql_filter: area>power(ZRES5,2)
tolerance: ZRES6
# etldoc: osm_boundary_polygon_gen_z8 -> osm_boundary_polygon_gen_z7
boundary_polygon_gen_z7:
source: boundary_polygon_gen_z8
sql_filter: area>power(ZRES6,2)
tolerance: ZRES7
# etldoc: osm_boundary_polygon_gen_z9 -> osm_boundary_polygon_gen_z8
boundary_polygon_gen_z8:
source: boundary_polygon_gen_z9
sql_filter: area>power(ZRES7,2)
tolerance: ZRES8
# etldoc: osm_boundary_polygon_gen_z10 -> osm_boundary_polygon_gen_z9
boundary_polygon_gen_z9:
source: boundary_polygon_gen_z10
sql_filter: area>power(ZRES8,2)
tolerance: ZRES9
# etldoc: osm_boundary_polygon_gen_z11 -> osm_boundary_polygon_gen_z10
boundary_polygon_gen_z10:
source: boundary_polygon_gen_z11
sql_filter: area>power(ZRES9,2)
tolerance: ZRES10
# etldoc: osm_boundary_polygon_gen_z12 -> osm_boundary_polygon_gen_z11
boundary_polygon_gen_z11:
source: boundary_polygon_gen_z12
sql_filter: area>power(ZRES10,2)
tolerance: ZRES11
# etldoc: osm_boundary_polygon_gen_z13 -> osm_boundary_polygon_gen_z12
boundary_polygon_gen_z12:
source: boundary_polygon_gen_z13
sql_filter: area>power(ZRES11,2)
tolerance: ZRES12
# etldoc: osm_boundary_polygon -> osm_boundary_polygon_gen_z13
boundary_polygon_gen_z13:
source: boundary_polygon
sql_filter: area>power(ZRES12,2) AND ST_IsValid(geometry)
tolerance: ZRES13
tables:
# etldoc: imposm3 -> osm_border_linestring
border_linestring:
@ -71,3 +132,29 @@ tables:
- dispute
boundary_type:
- maritime
# etldoc: imposm3 -> osm_boundary_polygon
boundary_polygon:
type: polygon
filters:
require:
type: [boundary]
boundary: [aboriginal_lands]
columns:
- name: osm_id
type: id
- name: geometry
type: validated_geometry
- name: name
key: name
type: string
- name: tags
type: hstore_tags
- name: boundary
key: boundary
type: string
- name: area
type: area
mapping:
boundary:
- aboriginal_lands

Plik binarny nie jest wyświetlany.

Przed

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

Po

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

Wyświetl plik

@ -0,0 +1,221 @@
ALTER TABLE osm_boundary_polygon
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z13
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z12
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z11
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z10
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z9
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z8
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z7
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z6
ADD COLUMN IF NOT EXISTS geometry_point geometry;
ALTER TABLE osm_boundary_polygon_gen_z5
ADD COLUMN IF NOT EXISTS geometry_point geometry;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z13;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z12;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z11;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z10;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z9;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z8;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z7;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z6;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z5;
DROP TRIGGER IF EXISTS trigger_flag ON osm_boundary_polygon;
DROP TRIGGER IF EXISTS trigger_refresh ON boundary_polygon.updates;
-- etldoc: osm_boundary_polygon -> osm_boundary_polygon
-- etldoc: osm_boundary_polygon_gen_z13 -> osm_boundary_polygon_gen_z13
-- etldoc: osm_boundary_polygon_gen_z12 -> osm_boundary_polygon_gen_z12
-- etldoc: osm_boundary_polygon_gen_z11 -> osm_boundary_polygon_gen_z11
-- etldoc: osm_boundary_polygon_gen_z10 -> osm_boundary_polygon_gen_z10
-- etldoc: osm_boundary_polygon_gen_z9 -> osm_boundary_polygon_gen_z9
-- etldoc: osm_boundary_polygon_gen_z8 -> osm_boundary_polygon_gen_z8
-- etldoc: osm_boundary_polygon_gen_z7 -> osm_boundary_polygon_gen_z7
-- etldoc: osm_boundary_polygon_gen_z6 -> osm_boundary_polygon_gen_z6
-- etldoc: osm_boundary_polygon_gen_z5 -> osm_boundary_polygon_gen_z5
CREATE OR REPLACE FUNCTION update_osm_boundary_polygon() RETURNS void AS
$$
BEGIN
UPDATE osm_boundary_polygon
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
UPDATE osm_boundary_polygon_gen_z13
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
UPDATE osm_boundary_polygon_gen_z12
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
UPDATE osm_boundary_polygon_gen_z11
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
UPDATE osm_boundary_polygon_gen_z10
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
UPDATE osm_boundary_polygon_gen_z9
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
UPDATE osm_boundary_polygon_gen_z8
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
UPDATE osm_boundary_polygon_gen_z7
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
UPDATE osm_boundary_polygon_gen_z6
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
UPDATE osm_boundary_polygon_gen_z5
SET tags = update_tags(tags, geometry),
geometry_point = st_centroid(geometry);
END;
$$ LANGUAGE plpgsql;
SELECT update_osm_boundary_polygon();
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_point_geom_idx ON osm_boundary_polygon USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z13_point_geom_idx ON osm_boundary_polygon_gen_z13 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z12_point_geom_idx ON osm_boundary_polygon_gen_z12 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z11_point_geom_idx ON osm_boundary_polygon_gen_z11 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z10_point_geom_idx ON osm_boundary_polygon_gen_z10 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z9_point_geom_idx ON osm_boundary_polygon_gen_z9 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z8_point_geom_idx ON osm_boundary_polygon_gen_z8 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z7_point_geom_idx ON osm_boundary_polygon_gen_z7 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z6_point_geom_idx ON osm_boundary_polygon_gen_z6 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z5_point_geom_idx ON osm_boundary_polygon_gen_z5 USING gist (geometry_point);
CREATE SCHEMA IF NOT EXISTS boundary_polygon;
CREATE TABLE IF NOT EXISTS boundary_polygon.updates
(
id serial PRIMARY KEY,
t text,
UNIQUE (t)
);
CREATE OR REPLACE FUNCTION boundary_polygon.flag() RETURNS trigger AS
$$
BEGIN
INSERT INTO boundary_polygon.updates(t) VALUES ('y') ON CONFLICT(t) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION boundary_polygon.refresh() RETURNS trigger AS
$$
DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh boundary_polygon';
-- Analyze tracking and source tables before performing update
ANALYZE osm_boundary_polygon_gen_z5;
REFRESH MATERIALIZED VIEW osm_boundary_polygon_gen_z5;
-- noinspection SqlWithoutWhere
DELETE FROM boundary_polygon.updates;
RAISE LOG 'Refresh boundary_polygon done in %', age(clock_timestamp(), t);
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION update_osm_boundary_polygon_row()
RETURNS trigger
AS
$$
BEGIN
NEW.tags = update_tags(NEW.tags, NEW.geometry);
NEW.geometry_point = st_centroid(NEW.geometry);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z13
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z12
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z11
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z10
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z9
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z8
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z7
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z6
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_boundary_polygon_gen_z5
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
ON osm_boundary_polygon
FOR EACH STATEMENT
EXECUTE PROCEDURE boundary_polygon.flag();
CREATE CONSTRAINT TRIGGER trigger_refresh
AFTER INSERT
ON boundary_polygon.updates
INITIALLY DEFERRED
FOR EACH ROW
EXECUTE PROCEDURE boundary_polygon.refresh();

Wyświetl plik

@ -101,4 +101,3 @@ tables:
boundary:
- national_park
- protected_area
- aboriginal_lands

Plik binarny nie jest wyświetlany.

Przed

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

Po

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

Wyświetl plik

@ -26,12 +26,11 @@ SELECT osm_id,
FROM (
SELECT osm_id,
geometry,
CASE WHEN boundary='aboriginal_lands' THEN 'aboriginal_lands'
ELSE COALESCE(
LOWER(REPLACE(NULLIF(protection_title, ''), ' ', '_')),
NULLIF(boundary, ''),
NULLIF(leisure, '')
) END AS class,
COALESCE(
LOWER(REPLACE(NULLIF(protection_title, ''), ' ', '_')),
NULLIF(boundary, ''),
NULLIF(leisure, ''))
AS class,
name,
name_en,
name_de,
@ -46,7 +45,7 @@ FROM (
NULL AS name_de,
NULL AS tags,
NULL AS leisure,
CASE WHEN boundary='aboriginal_lands' THEN boundary END AS boundary,
NULL AS boundary,
NULL AS protection_title
FROM osm_park_polygon_dissolve_z4
WHERE zoom_level = 4

Wyświetl plik

@ -5,15 +5,11 @@ layer:
such as parks tagged with [`boundary=national_park`](https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dnational_park),
[`boundary=protected_area`](https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dprotected_area),
or [`leisure=nature_reserve`](https://wiki.openstreetmap.org/wiki/Tag:leisure%3Dnature_reserve).
This layer also includes boundaries for indigenous lands tagged with
[`boundary=aboriginal_lands`](https://wiki.openstreetmap.org/wiki/Tag:boundary%3Daboriginal_lands).
Indigenous boundaries are not parks, but they are included in this layer for technical reasons related to data processing.
These boundaries represent areas with special legal and administrative status for indigenous peoples.
buffer_size: 4
fields:
class:
description: |
Use the **class** to differentiate between different kinds of features in the `parks` layer, for example between parks and non-parks.
Use the **class** to differentiate between different kinds of features in the `parks` layer.
The class for `boundary=protected_area` parks is the lower-case of the
[`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
value with blanks replaced by `_`.
@ -21,7 +17,6 @@ layer:
`nature_reserve` is the class of `protection_title=Nature Reserve` and `leisure=nature_reserve`.
The class for other [`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
values is similarly assigned.
The class for `boundary=aboriginal_lands` is `aboriginal_lands`.
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the park (point features only). Language-specific values are in `name:xx`.
name_en: English name `name:en` if available, otherwise `name` (point features only). This is deprecated and will be removed in a future release in favor of `name:en`.
name_de: German name `name:de` if available, otherwise `name` or `name:en` (point features only). This is deprecated and will be removed in a future release in favor of `name:de`.

Wyświetl plik

@ -1,10 +1,12 @@
CREATE OR REPLACE FUNCTION island_rank(area real) RETURNS int AS
CREATE OR REPLACE FUNCTION area_rank(area real) RETURNS int AS
$$
SELECT CASE
WHEN area < 10000000 THEN 6
WHEN area BETWEEN 1000000 AND 15000000 THEN 5
WHEN area BETWEEN 15000000 AND 40000000 THEN 4
WHEN area > 40000000 THEN 3
WHEN area > 160000000 THEN 2
WHEN area > 640000000 THEN 1
ELSE 7
END;
$$ LANGUAGE SQL IMMUTABLE

Plik binarny nie jest wyświetlany.

Przed

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

Po

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

Wyświetl plik

@ -109,17 +109,39 @@ FROM (
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
tags,
'island' AS class,
island_rank(area) AS "rank",
area_rank(area) AS "rank",
NULL::int AS capital,
NULL::text AS iso_a2
FROM osm_island_polygon
WHERE geometry && bbox
AND ((zoom_level = 8 AND island_rank(area) <= 3)
OR (zoom_level = 9 AND island_rank(area) <= 4)
AND ((zoom_level = 8 AND area_rank(area) <= 3)
OR (zoom_level = 9 AND area_rank(area) <= 4)
OR (zoom_level >= 10))
UNION ALL
SELECT
-- etldoc: osm_boundary_polygon -> layer_place:z6_11
-- etldoc: osm_boundary_polygon -> layer_place:z12_14
osm_id * 10 AS osm_id,
geometry_point,
name,
NULL::text AS name_en, -- deprecated
NULL::text AS name_de, -- deprecated
tags,
'aboriginal_lands' AS class,
area_rank(area) AS "rank",
NULL::int AS capital,
NULL::text AS iso_a2
FROM osm_boundary_polygon
WHERE geometry_point && bbox
AND ((zoom_level = 6 AND area_rank(area) <= 1)
OR (zoom_level = 7 AND area_rank(area) <= 2)
OR (zoom_level = 8 AND area_rank(area) <= 3)
OR (zoom_level = 9 AND area_rank(area) <= 4)
OR (zoom_level >= 10))
UNION ALL
SELECT
-- etldoc: layer_city -> layer_place:z0_3
-- etldoc: layer_city -> layer_place:z4_7

Wyświetl plik

@ -5,6 +5,9 @@ layer:
- ne_10m_admin_1_states_provinces
- ne_10m_admin_0_countries
- ne_10m_populated_places
requires:
layers:
- boundary
description: |
The place layer consists out of [countries](http://wiki.openstreetmap.org/wiki/Tag:place%3Dcountry),
[states](http://wiki.openstreetmap.org/wiki/Tag:place%3Dstate), [cities](http://wiki.openstreetmap.org/wiki/Key:place)
@ -28,7 +31,9 @@ layer:
Distinguish between continents, countries, states, islands and
places like settlements or smaller entities.
Use **class** to separately style the different places and build
a text hierarchy according to their importance.
a text hierarchy according to their importance. For places derived
from boundaries, the original value of the
[`boundary`](http://wiki.openstreetmap.org/wiki/Key:boundary) tag.
values:
- continent
- country
@ -44,6 +49,7 @@ layer:
- neighbourhood
- isolated_dwelling
- island
- aboriginal_lands
iso_a2:
description: |
Two-letter country code [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Available only for `class=country`.
@ -75,7 +81,7 @@ schema:
- ./types.sql
- ./capital.sql
- ./city.sql
- ./island_rank.sql
- ./area_rank.sql
- ./update_continent_point.sql
- ./update_country_point.sql
- ./update_island_polygon.sql