add etldoc to layer_railway

pull/17/head
ImreSamu 2016-11-10 13:24:18 +01:00
rodzic dd2fc0e2dd
commit 36d7fa6227
3 zmienionych plików z 28 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,22 @@
ID=railway
DOT=${ID}.dot
echo "digraph G
{
rankdir=LR;
" > $DOT
cat ./layers/${ID}/mapping.yaml | grep "# etldoc:" | sed 's/# etldoc://g' >>$DOT
cat ./layers/${ID}/types.sql | grep "\-\- etldoc:" | sed 's/-- etldoc://g' >>$DOT
cat ./layers/${ID}/railway.sql | grep "\-\- etldoc:" | sed 's/-- etldoc://g' >>$DOT
echo "
}
" >> $DOT
cat $DOT
dot -Tpng $DOT > layer_${ID}_etl.png

Wyświetl plik

@ -1,4 +1,5 @@
tables:
# etldoc: imposm3 -> osm_railway_linestring
railway_linestring:
type: linestring
fields:

Wyświetl plik

@ -13,6 +13,9 @@ CREATE OR REPLACE FUNCTION railway_brunnel(is_bridge boolean, is_tunnel boolean)
END;
$$ LANGUAGE SQL IMMUTABLE;
-- etldoc: layer_railway[shape=record fillcolor=lightpink, style="rounded,filled",
-- etldoc: label="layer_railway | <z13> z13 | <z14_> z14_" ] ;
CREATE OR REPLACE FUNCTION layer_railway(bbox geometry, zoom_level int)
RETURNS TABLE(osm_id bigint, geometry geometry, class text, subclass text, properties railway_properties) AS $$
SELECT osm_id, geometry,
@ -20,9 +23,11 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class text, subclass text, prope
railway AS subclass,
to_railway_properties(is_bridge, is_tunnel) AS properties
FROM (
-- etldoc: osm_railway_linestring -> layer_railway :z13
SELECT * FROM osm_railway_linestring
WHERE zoom_level = 13 AND railway = 'rail' AND service=''
UNION ALL
-- etldoc: osm_railway_linestring -> layer_railway :z14_
SELECT * FROM osm_railway_linestring WHERE zoom_level >= 14
) AS zoom_levels
WHERE geometry && bbox