Add rail layer
This commit is contained in:
parent
e792b8486c
commit
85e2ce0a83
23
data.yml
23
data.yml
@ -78,6 +78,29 @@ Layer:
|
|||||||
properties:
|
properties:
|
||||||
"buffer-size": 4
|
"buffer-size": 4
|
||||||
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
|
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: rail
|
||||||
|
Datasource:
|
||||||
|
dbname: osm
|
||||||
|
extent: -20037508.34,-20037508.34,20037508.34,20037508.34
|
||||||
|
geometry_field: geom
|
||||||
|
geometry_table: ''
|
||||||
|
host: db
|
||||||
|
key_field: ''
|
||||||
|
key_field_as_attribute: ''
|
||||||
|
max_size: 512
|
||||||
|
password: osm
|
||||||
|
port: 5432
|
||||||
|
srid: 900913
|
||||||
|
table: (SELECT * FROM layer_rail(!bbox!, z(!scale_denominator!))) AS t
|
||||||
|
type: postgis
|
||||||
|
user: osm
|
||||||
|
description: Buildings
|
||||||
|
fields:
|
||||||
|
brunnel: String
|
||||||
|
class: String
|
||||||
|
properties:
|
||||||
|
"buffer-size": 4
|
||||||
|
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: ice
|
- id: ice
|
||||||
Datasource:
|
Datasource:
|
||||||
dbname: osm
|
dbname: osm
|
||||||
|
|||||||
@ -25,6 +25,7 @@ function main() {
|
|||||||
exec_psql_file "layers/place.sql"
|
exec_psql_file "layers/place.sql"
|
||||||
exec_psql_file "layers/country.sql"
|
exec_psql_file "layers/country.sql"
|
||||||
exec_psql_file "layers/state.sql"
|
exec_psql_file "layers/state.sql"
|
||||||
|
exec_psql_file "layers/rail.sql"
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|||||||
18
schema/layers/rail.sql
Normal file
18
schema/layers/rail.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
CREATE OR REPLACE VIEW rail_z13 AS (
|
||||||
|
SELECT * FROM rail
|
||||||
|
WHERE class='rail'
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW rail_z14 AS (
|
||||||
|
SELECT * FROM rail
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION layer_rail(bbox geometry, zoom_level int)
|
||||||
|
RETURNS TABLE(geom geometry, class text, brunnel text) AS $$
|
||||||
|
SELECT way AS geom, class::text, brunnel::text FROM (
|
||||||
|
SELECT * FROM rail_z13 WHERE zoom_level = 13
|
||||||
|
UNION ALL
|
||||||
|
SELECT * FROM rail_z14 WHERE zoom_level >= 14
|
||||||
|
) AS zoom_levels
|
||||||
|
WHERE way && bbox;
|
||||||
|
$$ LANGUAGE SQL IMMUTABLE;
|
||||||
Loading…
x
Reference in New Issue
Block a user