Cleaned up more code from landmark that wasn't used. Experimenting with power generator:source stuff
This commit is contained in:
parent
277829f9a0
commit
bd1325109a
@ -1,10 +1,10 @@
|
|||||||
## lm
|
## Landmarks
|
||||||
|
|
||||||
### Docs
|
### Docs
|
||||||
Read the layer documentation at **http://openmaptiles.org/schema#lm**
|
This is a custom layer including landmarks (named forests) that can not be classified as a POI
|
||||||
|
|
||||||
### Mapping Diagram
|
### Mapping Diagram
|
||||||

|
|
||||||
|
|
||||||
### ETL diagram
|
### ETL diagram
|
||||||

|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
layer:
|
layer:
|
||||||
id: "lm"
|
id: "landmarks"
|
||||||
description: |
|
description: |
|
||||||
[Points of interests](http://wiki.openstreetmap.org/wiki/Points_of_interest) containing
|
[Points of interests](http://wiki.openstreetmap.org/wiki/Points_of_interest) containing
|
||||||
a of a variety of OpenStreetMap tags. Mostly contains amenities, sport, shop and tourist POIs.
|
a of a variety of OpenStreetMap tags. Mostly contains amenities, sport, shop and tourist POIs.
|
||||||
@ -11,10 +11,8 @@ layer:
|
|||||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||||
class:
|
class:
|
||||||
description: |
|
description: |
|
||||||
More general classes of POIs. If there is no more general `class` for the `subclass`
|
More general classes of landmarks. If there is no more general `class` for the `subclass`
|
||||||
this field will contain the same value as `subclass`.
|
this field will contain the same value as `subclass`.
|
||||||
But for example for schools you only need to style the class `school` to filter the subclasses `school`
|
|
||||||
and `kindergarten`. Or use the class `shop` to style all shops.
|
|
||||||
values:
|
values:
|
||||||
shop:
|
shop:
|
||||||
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist',
|
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist',
|
||||||
@ -119,14 +117,6 @@ layer:
|
|||||||
local relative importance of a POI within it's cell in the grid. This can be used to reduce label density at *z14*.
|
local relative importance of a POI within it's cell in the grid. This can be used to reduce label density at *z14*.
|
||||||
Since all POIs already need to be contained at *z14* you can use `less than rank=10` epxression to limit
|
Since all POIs already need to be contained at *z14* you can use `less than rank=10` epxression to limit
|
||||||
LMs. At some point like *z17* you can show all LMs.
|
LMs. At some point like *z17* you can show all LMs.
|
||||||
agg_stop:
|
|
||||||
description: |
|
|
||||||
Experimental feature! Indicates main platform of public transport
|
|
||||||
stops (buses, trams, and subways). Grouping of platforms is
|
|
||||||
implemented using
|
|
||||||
[`uic_ref`](http://wiki.openstreetmap.org/wiki/Key:uic_ref) tag that
|
|
||||||
is not used worldwide.
|
|
||||||
values: [1]
|
|
||||||
level:
|
level:
|
||||||
description: |
|
description: |
|
||||||
Original value of [`level`](http://wiki.openstreetmap.org/wiki/Key:level) tag.
|
Original value of [`level`](http://wiki.openstreetmap.org/wiki/Key:level) tag.
|
||||||
@ -138,11 +128,9 @@ layer:
|
|||||||
key_field: osm_id
|
key_field: osm_id
|
||||||
key_field_as_attribute: no
|
key_field_as_attribute: no
|
||||||
srid: 900913
|
srid: 900913
|
||||||
query: (SELECT osm_id, geometry, name, name_en, name_de, {name_languages}, class, subclass, agg_stop, layer, level, rank FROM layer_lm(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
|
query: (SELECT osm_id, geometry, name, name_en, name_de, {name_languages}, class, subclass, layer, level, rank FROM layer_lm(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
|
||||||
schema:
|
schema:
|
||||||
- ./public_transport_stop_type.sql
|
|
||||||
- ./class.sql
|
- ./class.sql
|
||||||
- ./lm_stop_agg.sql
|
|
||||||
- ./update_lm_polygon.sql
|
- ./update_lm_polygon.sql
|
||||||
- ./update_lm_point.sql
|
- ./update_lm_point.sql
|
||||||
- ./layer.sql
|
- ./layer.sql
|
||||||
|
|||||||
@ -12,7 +12,6 @@ CREATE OR REPLACE FUNCTION layer_lm(bbox geometry, zoom_level integer, pixel_wid
|
|||||||
tags hstore,
|
tags hstore,
|
||||||
class text,
|
class text,
|
||||||
subclass text,
|
subclass text,
|
||||||
agg_stop integer,
|
|
||||||
layer integer,
|
layer integer,
|
||||||
level integer,
|
level integer,
|
||||||
"rank" int
|
"rank" int
|
||||||
@ -27,7 +26,6 @@ SELECT osm_id_hash AS osm_id,
|
|||||||
tags,
|
tags,
|
||||||
lm_class(subclass, mapping_key) AS class,
|
lm_class(subclass, mapping_key) AS class,
|
||||||
subclass AS subclass,
|
subclass AS subclass,
|
||||||
agg_stop,
|
|
||||||
NULLIF(layer, 0) AS layer,
|
NULLIF(layer, 0) AS layer,
|
||||||
"level",
|
"level",
|
||||||
row_number() OVER (
|
row_number() OVER (
|
||||||
@ -59,7 +57,6 @@ FROM (
|
|||||||
-- etldoc: osm_lm_polygon -> layer_lm:z12
|
-- etldoc: osm_lm_polygon -> layer_lm:z12
|
||||||
-- etldoc: osm_lm_polygon -> layer_lm:z13
|
-- etldoc: osm_lm_polygon -> layer_lm:z13
|
||||||
SELECT *,
|
SELECT *,
|
||||||
NULL::integer AS agg_stop,
|
|
||||||
CASE
|
CASE
|
||||||
WHEN osm_id < 0 THEN -osm_id * 10 + 4
|
WHEN osm_id < 0 THEN -osm_id * 10 + 4
|
||||||
ELSE osm_id * 10 + 1
|
ELSE osm_id * 10 + 1
|
||||||
@ -74,7 +71,6 @@ FROM (
|
|||||||
|
|
||||||
-- etldoc: osm_lm_polygon -> layer_lm:z14_
|
-- etldoc: osm_lm_polygon -> layer_lm:z14_
|
||||||
SELECT *,
|
SELECT *,
|
||||||
NULL::integer AS agg_stop,
|
|
||||||
CASE
|
CASE
|
||||||
WHEN osm_id < 0 THEN -osm_id * 10 + 4
|
WHEN osm_id < 0 THEN -osm_id * 10 + 4
|
||||||
ELSE osm_id * 10 + 1
|
ELSE osm_id * 10 + 1
|
||||||
|
|||||||
@ -1,31 +0,0 @@
|
|||||||
DROP MATERIALIZED VIEW IF EXISTS osm_lm_stop_centroid CASCADE;
|
|
||||||
CREATE MATERIALIZED VIEW osm_lm_stop_centroid AS
|
|
||||||
(
|
|
||||||
SELECT uic_ref,
|
|
||||||
count(*) AS count,
|
|
||||||
CASE WHEN count(*) > 2 THEN ST_Centroid(ST_UNION(geometry)) END AS centroid
|
|
||||||
FROM osm_lm_point
|
|
||||||
WHERE nullif(uic_ref, '') IS NOT NULL
|
|
||||||
AND subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
|
|
||||||
GROUP BY uic_ref
|
|
||||||
HAVING count(*) > 1
|
|
||||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
|
||||||
|
|
||||||
DROP MATERIALIZED VIEW IF EXISTS osm_lm_stop_rank CASCADE;
|
|
||||||
CREATE MATERIALIZED VIEW osm_lm_stop_rank AS
|
|
||||||
(
|
|
||||||
SELECT p.osm_id,
|
|
||||||
-- p.uic_ref,
|
|
||||||
-- p.subclass,
|
|
||||||
ROW_NUMBER()
|
|
||||||
OVER (
|
|
||||||
PARTITION BY p.uic_ref
|
|
||||||
ORDER BY
|
|
||||||
p.subclass :: public_transport_stop_type NULLS LAST,
|
|
||||||
ST_Distance(c.centroid, p.geometry)
|
|
||||||
) AS rk
|
|
||||||
FROM osm_lm_point p
|
|
||||||
INNER JOIN osm_lm_stop_centroid c ON (p.uic_ref = c.uic_ref)
|
|
||||||
WHERE subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
|
|
||||||
ORDER BY p.uic_ref, rk
|
|
||||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
DO
|
|
||||||
$$
|
|
||||||
BEGIN
|
|
||||||
IF NOT EXISTS(SELECT 1
|
|
||||||
FROM pg_type
|
|
||||||
WHERE typname = 'public_transport_stop_type') THEN
|
|
||||||
CREATE TYPE public_transport_stop_type AS enum (
|
|
||||||
'subway', 'tram_stop', 'bus_station', 'bus_stop'
|
|
||||||
);
|
|
||||||
END IF;
|
|
||||||
END
|
|
||||||
$$;
|
|
||||||
@ -24,32 +24,6 @@ $$ LANGUAGE plpgsql;
|
|||||||
|
|
||||||
SELECT update_osm_lm_point();
|
SELECT update_osm_lm_point();
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION update_osm_lm_point_agg() RETURNS void AS
|
|
||||||
$$
|
|
||||||
BEGIN
|
|
||||||
UPDATE osm_lm_point p
|
|
||||||
SET agg_stop = CASE
|
|
||||||
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
|
|
||||||
THEN 1
|
|
||||||
END;
|
|
||||||
|
|
||||||
UPDATE osm_lm_point p
|
|
||||||
SET agg_stop = (
|
|
||||||
CASE
|
|
||||||
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
|
|
||||||
AND r.rk IS NULL OR r.rk = 1
|
|
||||||
THEN 1
|
|
||||||
END)
|
|
||||||
FROM osm_lm_stop_rank r
|
|
||||||
WHERE p.osm_id = r.osm_id;
|
|
||||||
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
|
|
||||||
ALTER TABLE osm_lm_point
|
|
||||||
ADD COLUMN IF NOT EXISTS agg_stop integer DEFAULT NULL;
|
|
||||||
SELECT update_osm_lm_point_agg();
|
|
||||||
|
|
||||||
-- Handle updates
|
-- Handle updates
|
||||||
|
|
||||||
CREATE SCHEMA IF NOT EXISTS lm_point;
|
CREATE SCHEMA IF NOT EXISTS lm_point;
|
||||||
@ -75,7 +49,6 @@ BEGIN
|
|||||||
PERFORM update_osm_lm_point();
|
PERFORM update_osm_lm_point();
|
||||||
REFRESH MATERIALIZED VIEW osm_lm_stop_centroid;
|
REFRESH MATERIALIZED VIEW osm_lm_stop_centroid;
|
||||||
REFRESH MATERIALIZED VIEW osm_lm_stop_rank;
|
REFRESH MATERIALIZED VIEW osm_lm_stop_rank;
|
||||||
PERFORM update_osm_lm_point_agg();
|
|
||||||
-- noinspection SqlWithoutWhere
|
-- noinspection SqlWithoutWhere
|
||||||
DELETE FROM lm_point.updates;
|
DELETE FROM lm_point.updates;
|
||||||
RETURN NULL;
|
RETURN NULL;
|
||||||
|
|||||||
@ -34,6 +34,8 @@ SELECT osm_id_hash AS osm_id,
|
|||||||
THEN NULLIF(religion, '')
|
THEN NULLIF(religion, '')
|
||||||
WHEN subclass = 'pitch'
|
WHEN subclass = 'pitch'
|
||||||
THEN NULLIF(sport, '')
|
THEN NULLIF(sport, '')
|
||||||
|
when class = 'power'
|
||||||
|
THEN NULLIF(source, '')
|
||||||
ELSE subclass
|
ELSE subclass
|
||||||
END AS subclass,
|
END AS subclass,
|
||||||
agg_stop,
|
agg_stop,
|
||||||
|
|||||||
@ -62,6 +62,7 @@ def_poi_mapping_amenity: &poi_mapping_amenity
|
|||||||
- university
|
- university
|
||||||
- veterinary
|
- veterinary
|
||||||
- waste_basket
|
- waste_basket
|
||||||
|
- charging_station
|
||||||
|
|
||||||
# barrier values , see http://taginfo.openstreetmap.org/keys/barrier#values
|
# barrier values , see http://taginfo.openstreetmap.org/keys/barrier#values
|
||||||
def_poi_mapping_barrier: &poi_mapping_barrier
|
def_poi_mapping_barrier: &poi_mapping_barrier
|
||||||
@ -319,6 +320,15 @@ def_poi_mapping_tourism: &poi_mapping_tourism
|
|||||||
def_poi_mapping_waterway: &poi_mapping_waterway
|
def_poi_mapping_waterway: &poi_mapping_waterway
|
||||||
- dock
|
- dock
|
||||||
|
|
||||||
|
# aeroway values , see http://taginfo.openstreetmap.org/keys/aeroway#values
|
||||||
|
def_poi_mapping_aeroway: &poi_mapping_aeroway
|
||||||
|
- helipad
|
||||||
|
- aerodrome
|
||||||
|
|
||||||
|
# aeroway values , see http://taginfo.openstreetmap.org/keys/aeroway#values
|
||||||
|
def_poi_mapping_power: &poi_mapping_power
|
||||||
|
- generator
|
||||||
|
|
||||||
def_poi_fields: &poi_fields
|
def_poi_fields: &poi_fields
|
||||||
- name: osm_id
|
- name: osm_id
|
||||||
type: id
|
type: id
|
||||||
@ -366,6 +376,9 @@ def_poi_fields: &poi_fields
|
|||||||
- name: sport
|
- name: sport
|
||||||
key: sport
|
key: sport
|
||||||
type: string
|
type: string
|
||||||
|
- name: source
|
||||||
|
key: "generator:source"
|
||||||
|
type: string
|
||||||
|
|
||||||
def_poi_mapping: &poi_mapping
|
def_poi_mapping: &poi_mapping
|
||||||
aerialway: *poi_mapping_aerialway
|
aerialway: *poi_mapping_aerialway
|
||||||
@ -381,6 +394,8 @@ def_poi_mapping: &poi_mapping
|
|||||||
sport: *poi_mapping_sport
|
sport: *poi_mapping_sport
|
||||||
tourism: *poi_mapping_tourism
|
tourism: *poi_mapping_tourism
|
||||||
waterway: *poi_mapping_waterway
|
waterway: *poi_mapping_waterway
|
||||||
|
aeroway: *poi_mapping_aeroway
|
||||||
|
power: *poi_mapping_power
|
||||||
|
|
||||||
tables:
|
tables:
|
||||||
# etldoc: imposm3 -> osm_poi_point
|
# etldoc: imposm3 -> osm_poi_point
|
||||||
|
|||||||
@ -124,6 +124,10 @@ layer:
|
|||||||
subclass: ['swimming_area', 'swimming']
|
subclass: ['swimming_area', 'swimming']
|
||||||
castle:
|
castle:
|
||||||
subclass: ['castle', 'ruins']
|
subclass: ['castle', 'ruins']
|
||||||
|
airport:
|
||||||
|
subclass: ['aerodrome']
|
||||||
|
heliport:
|
||||||
|
subclass: ['helipad']
|
||||||
subclass:
|
subclass:
|
||||||
description: |
|
description: |
|
||||||
Original value of either the
|
Original value of either the
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user