Merge pull request from osm2vectortiles/feature/mapping-improvements

Feature/mapping improvements
pull/220/head
Lukas Martinelli 2016-04-01 14:47:26 +02:00
commit bc6e5ae1e3
10 zmienionych plików z 221 dodań i 48 usunięć

Wyświetl plik

@ -717,7 +717,7 @@ Layer:
coalesce(NULLIF(name_ru, ''), name) AS name_ru,
coalesce(NULLIF(name_zh, ''), name) AS name_zh,
type,
CASE WHEN is_capital THEN 1 ELSE NULL END AS capital,
capital,
NULL AS ldir,
normalize_scalerank(scalerank) AS scalerank,
rank() OVER (PARTITION BY LabelGrid(geometry, 200 * !pixel_width!)
@ -756,7 +756,7 @@ Layer:
user: osm
description: ''
fields:
capital: String
capital: Number
ldir: String
localrank: Number
name: String
@ -1004,6 +1004,54 @@ Layer:
properties:
"buffer-size": 8
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
- id: mountain_peak_label
Datasource:
dbname: osm
extent: -20037508.34,-20037508.34,20037508.34,20037508.34
geometry_field: ''
geometry_table: ''
host: db
key_field: ''
key_field_as_attribute: ''
max_size: 512
password: osm
port: 5432
srid: ''
table: |-
(
SELECT osm_id, geometry,
meter_to_feet(elevation_m) AS elevation_ft,
elevation_m,
type AS maki,
name,
coalesce(NULLIF(name_en, ''), name) AS name_en,
coalesce(NULLIF(name_es, ''), name) AS name_es,
coalesce(NULLIF(name_fr, ''), name) AS name_fr,
coalesce(NULLIF(name_de, ''), name) AS name_de,
coalesce(NULLIF(name_ru, ''), name) AS name_ru,
coalesce(NULLIF(name_zh, ''), name) AS name_zh
FROM mountain_peak_label_z12toz14
WHERE geometry && !bbox!
AND z(!scale_denominator!) BETWEEN 12 AND 14
) AS data
type: postgis
user: osm
description: ''
fields:
osm_id: Number
elevation_ft: Number
elevation_m: Number
maki: String
name: String
name_de: String
name_en: String
name_es: String
name_fr: String
name_ru: String
name_zh: String
properties:
"buffer-size": 64
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
- id: housenum_label
Datasource:
dbname: osm

Wyświetl plik

@ -75,6 +75,7 @@ function update_timestamp() {
exec_sql "UPDATE osm_water_linestring SET timestamp='$timestamp' WHERE timestamp IS NULL"
exec_sql "UPDATE osm_water_polygon SET timestamp='$timestamp' WHERE timestamp IS NULL"
exec_sql "UPDATE osm_water_polygon_gen1 SET timestamp='$timestamp' WHERE timestamp IS NULL"
exec_sql "UPDATE osm_mountain_peak_point SET timestamp='$timestamp' WHERE timestamp IS NULL"
}
function enable_change_tracking() {
@ -108,6 +109,7 @@ function drop_tables() {
exec_sql "DROP TABLE IF EXISTS osm_water_polygon_gen1 CASCADE"
exec_sql "DROP TABLE IF EXISTS osm_poi_polygon CASCADE"
exec_sql "DROP TABLE IF EXISTS osm_poi_point CASCADE"
exec_sql "DROP TABLE IF EXISTS osm_mountain_peak_point CASCADE"
}
function cleanup_osm_changes() {

Wyświetl plik

@ -225,6 +225,16 @@ tables:
- forest
- cemetery
- beach
- quarry
- residential
- commercial
- retail
- military
- railway
- greenfield
- landfill
- salt_pond
- winter_sports
leisure:
- park
- playground
@ -244,6 +254,13 @@ tables:
- scrub
- wetland
- mud
- beach
- rock
- bare_rock
- scree
- grassland
- heath
- fell
wetland:
- marsh
- swamp
@ -300,8 +317,8 @@ tables:
name: population
type: integer
- key: capital
name: is_capital
type: bool
name: capital
type: integer
- key: admin_level
name: admin_level
type: integer
@ -321,7 +338,9 @@ tables:
- suburb
- neighbourhood
- locality
- dwelling
- isolated_dwelling
- island
- islet
type: point
road_linestring:
type: linestring
@ -382,7 +401,6 @@ tables:
filters:
exclude_tags:
- ["area", "yes"]
- ["amenity", "parking"]
mappings:
railway:
mapping:
@ -404,6 +422,8 @@ tables:
- siding
- crossover
- parking_aisle
- emergency_access
- drive-through
roads:
mapping:
highway:
@ -447,6 +467,10 @@ tables:
- canopy
golf:
- hole
route:
- ferry
- ski
- piste
road_polygon:
type: polygon
fields:
@ -503,7 +527,6 @@ tables:
- name: name_zh
key: name:zh
type: string
filters:
mappings:
railway:
mapping:
@ -525,6 +548,7 @@ tables:
- siding
- crossover
- parking_aisle
- drive-through
roads:
mapping:
highway:
@ -568,6 +592,8 @@ tables:
- canopy
golf:
- hole
amenity:
- parking
water_polygon:
fields:
- name: osm_id
@ -670,6 +696,48 @@ tables:
- drain
- ditch
type: linestring
mountain_peak_point:
fields:
- name: osm_id
type: id
- name: geometry
type: geometry
- name: timestamp
type: pbf_timestamp
- key: ele
name: elevation_m
type: integer
- key: name
name: name
type: string
- name: name_int
key: int_name
type: string
- name: name_fr
key: name:fr
type: string
- name: name_en
key: name:en
type: string
- name: name_de
key: name:de
type: string
- name: name_es
key: name:es
type: string
- name: name_ru
key: name:ru
type: string
- name: name_zh
key: name:zh
type: string
- name: type
type: mapping_value
mapping:
natural:
- peak
- volcano
type: point
poi_polygon:
fields:
- name: osm_id
@ -789,6 +857,8 @@ tables:
- swimming_area
- water_park
- golf_course
- miniature_golf
- marina
- stadium
- ice_rink
- garden
@ -1000,21 +1070,12 @@ tables:
- cycle_barrier
- toll_booth
- border_control
aerialway:
- chair_lift
- mixed_lift
- drag_lift
- platter
- t-bar
- magic_carpet
- gondola
- cable_car
- rope_tow
- zip_line
- j-bar
- canopy
historic:
- monument
waterway:
- dock
aerialway:
- station
type: polygon
poi_point:
fields:
@ -1133,6 +1194,8 @@ tables:
- swimming_area
- water_park
- golf_course
- miniature_golf
- marina
- stadium
- ice_rink
- garden
@ -1344,19 +1407,10 @@ tables:
- cycle_barrier
- toll_booth
- border_control
aerialway:
- chair_lift
- mixed_lift
- drag_lift
- platter
- t-bar
- magic_carpet
- gondola
- cable_car
- rope_tow
- zip_line
- j-bar
- canopy
historic:
- monument
waterway:
- dock
aerialway:
- station
type: point

Wyświetl plik

@ -19,6 +19,8 @@ system:
- grass
- grassland
- meadow
- heath
- fell
hospital:
- hospital
industrial:
@ -41,8 +43,14 @@ system:
- athletics
- chess
- pitch
rock:
- rock
- bare_rock
- scree
- quarry
sand:
- sand
- beach
school:
- school
- college
@ -60,3 +68,21 @@ system:
wetland_noveg:
- mud
- tidalflat
residential:
- residential
commercial:
- commercial
retail:
- retail
military:
- military
railway:
- railway
greenfield:
- greenfield
landfill:
- landfill
salt_pond:
- salt_pond
winter_sports:
- winter_sports

Wyświetl plik

@ -1,19 +1,6 @@
system:
name: maki_label
classes:
aerialway:
- chair_lift
- mixed_lift
- drag_lift
- platter
- t-bar
- magic_carpet
- gondola
- cable_car
- rope_tow
- zip_line
- j-bar
- canopy
airport:
- aerodrome
- terminal
@ -119,6 +106,7 @@ system:
golf:
- golf
- golf_course
- miniature_golf
grocery:
- supermarket
- deli
@ -210,6 +198,9 @@ system:
highway:
- motorway_junction
- turning_circle
harbor:
- marina
- dock
ice-cream:
- chocolate
- confectionery
@ -330,8 +321,8 @@ system:
- watches
- weapons
- wholesale
skiing:
- skiing
aerialway:
- station
slaughterhouse:
- butcher
soccer:

Wyświetl plik

@ -33,10 +33,17 @@ system:
- spur
- siding
- crossover
- parking
- parking_aisle
- yard
- driveway
- emergency_access
- drive-through
path:
- path
- cycleway
- ski
- piste
- steps
- bridleway
- footway
@ -67,3 +74,6 @@ system:
- canopy
golf:
- hole
ferry:
- ferry

Wyświetl plik

@ -87,6 +87,13 @@ BEGIN
END;
$$ LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION meter_to_feet(meter INTEGER) RETURNS INTEGER
AS $$
BEGIN
RETURN round(meter * 3.28084);
END;
$$ LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION overlapping_tiles(
geom geometry,
max_zoom_level INTEGER
@ -170,6 +177,8 @@ BEGIN
SELECT * FROM changed_tiles_waterway(ts)
UNION
SELECT * FROM changed_tiles_waterway_label(ts)
UNION
SELECT * FROM changed_tiles_mountain_peak_label(ts)
);
END;
$$ LANGUAGE plpgsql;

Wyświetl plik

@ -45,6 +45,7 @@ function main() {
exec_sql_file "${SQL_VIEWS_DIR}water_label.sql"
exec_sql_file "${SQL_VIEWS_DIR}waterway.sql"
exec_sql_file "${SQL_VIEWS_DIR}waterway_label.sql"
exec_sql_file "${SQL_VIEWS_DIR}mountain_peak_label.sql"
}
main

Wyświetl plik

@ -126,6 +126,13 @@ CREATE TRIGGER osm_barrier_linestring_track_changes
BEFORE DELETE ON osm_barrier_linestring
FOR EACH ROW EXECUTE PROCEDURE track_osm_deletes();
-- Mountain Peaks
DROP TRIGGER IF EXISTS osm_mountain_peak_point_track_changes ON osm_mountain_peak_point;
CREATE TRIGGER osm_mountain_peak_point_track_changes
BEFORE DELETE ON osm_mountain_peak_point
FOR EACH ROW EXECUTE PROCEDURE track_osm_deletes();
CREATE OR REPLACE FUNCTION disable_change_tracking() returns VOID
AS $$
BEGIN
@ -145,6 +152,7 @@ BEGIN
ALTER TABLE osm_housenumber_point DISABLE TRIGGER USER;
ALTER TABLE osm_barrier_polygon DISABLE TRIGGER USER;
ALTER TABLE osm_barrier_linestring DISABLE TRIGGER USER;
ALTER TABLE osm_mountain_peak_point DISABLE TRIGGER USER;
END;
$$ language plpgsql;
@ -167,5 +175,6 @@ BEGIN
ALTER TABLE osm_housenumber_point ENABLE TRIGGER USER;
ALTER TABLE osm_barrier_polygon ENABLE TRIGGER USER;
ALTER TABLE osm_barrier_linestring ENABLE TRIGGER USER;
ALTER TABLE osm_mountain_peak_point ENABLE TRIGGER USER;
END;
$$ language plpgsql;

Wyświetl plik

@ -0,0 +1,23 @@
CREATE OR REPLACE VIEW mountain_peak_label_z12toz14 AS
SELECT *
FROM osm_mountain_peak_point;
CREATE OR REPLACE VIEW layer_mountain_peak_label AS (
SELECT osm_id, timestamp, geometry FROM mountain_peak_label_z12toz14
);
CREATE OR REPLACE FUNCTION changed_tiles_mountain_peak_label(ts timestamp)
RETURNS TABLE (x INTEGER, y INTEGER, z INTEGER) AS $$
BEGIN
RETURN QUERY (
WITH changed_tiles AS (
SELECT DISTINCT c.osm_id, t.tile_x AS x, t.tile_y AS y, t.tile_z AS z
FROM layer_mountain_peak_label AS c
INNER JOIN LATERAL overlapping_tiles(c.geometry, 14) AS t ON c.timestamp = ts
)
SELECT c.x, c.y, c.z FROM mountain_peak_label_z12toz14 AS l
INNER JOIN changed_tiles AS c ON c.osm_id = l.osm_id AND c.z BETWEEN 12 AND 14
);
END;
$$ LANGUAGE plpgsql;