diff --git a/gen_etl_graph.sh b/gen_etl_graph_highway.sh similarity index 100% rename from gen_etl_graph.sh rename to gen_etl_graph_highway.sh diff --git a/layers/highway/highway.sql b/layers/highway/highway.sql index d233f8c..921dce2 100644 --- a/layers/highway/highway.sql +++ b/layers/highway/highway.sql @@ -1,19 +1,12 @@ - - --- etldoc: highway_sql[label="highway.sql", shape=note ] --- etldoc: function_highway_is_link[label="FUNCTION highway_is_link"] --- etldoc: highway_sql-> function_highway_is_link --- etldoc: function_highway_is_link -> postgreSQL + CREATE OR REPLACE FUNCTION highway_is_link(highway TEXT) RETURNS BOOLEAN AS $$ SELECT highway LIKE '%_link'; $$ LANGUAGE SQL IMMUTABLE STRICT; --- etldoc: postgreSQL -> layer_highway --- etldoc: highway_sql-> layer_highway -- etldoc: layer_highway[shape=record fillcolor=lightpink, style="rounded,filled", --- etldoc: label=" layer_highway (highway.sql) | z4-z7 | z8 | z9 | z10 | z11 | z12| z13| z14" ] ; +-- etldoc: label=" layer_highway | z4-z7 | z8 | z9 | z10 | z11 | z12| z13| z14_" ] ; CREATE OR REPLACE FUNCTION layer_highway(bbox geometry, zoom_level int) RETURNS TABLE(osm_id bigint, geometry geometry, class highway_class, subclass text, properties highway_properties) AS $$ SELECT @@ -72,7 +65,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class highway_class, subclass te AND NOT is_area UNION ALL - -- etldoc: osm_highway_linestring -> layer_highway:z14 + -- etldoc: osm_highway_linestring -> layer_highway:z14_ SELECT osm_id, geometry, highway, is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, z_order FROM osm_highway_linestring WHERE zoom_level >= 14 AND NOT is_area @@ -81,7 +74,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class highway_class, subclass te -- NOTE: We limit the selection of polys because we need to be careful to net get false positives here because -- it is possible that closed linestrings appear both as highway linestrings and as polygon -- etldoc: osm_highway_polygon -> layer_highway:z13 - -- etldoc: osm_highway_polygon -> layer_highway:z14 + -- etldoc: osm_highway_polygon -> layer_highway:z14_ SELECT osm_id, geometry, highway, FALSE AS is_bridge, FALSE AS is_tunnel, FALSE AS is_ford, FALSE AS is_ramp, FALSE AS is_oneway, z_order FROM osm_highway_polygon -- We do not want underground pedestrian areas for now diff --git a/layers/highway/mapping.yaml b/layers/highway/mapping.yaml index 1f76e47..cbd8fed 100644 --- a/layers/highway/mapping.yaml +++ b/layers/highway/mapping.yaml @@ -1,15 +1,4 @@ - - -# etldoc: imposm3 [fillcolor=yellow, style="rounded,filled", shape=diamond ]; -# etldoc: osm [fillcolor=lightblue, -# etldoc: style="rounded,filled", -# etldoc: shape=box , label="OpenStreetMap", -# etldoc: url="http://www.openstreetmap.org"]; -# etldoc: mapping_yml[label="mapping.yml", shape=note ] -# etldoc: mapping_yml -> imposm3 -# etldoc: osm -> imposm3 - generalized_tables: # etldoc: imposm3 -> osm_highway_linestring_gen4 diff --git a/layers/highway/ne_global_roads.sql b/layers/highway/ne_global_roads.sql index 42ed1bd..71fdfc8 100644 --- a/layers/highway/ne_global_roads.sql +++ b/layers/highway/ne_global_roads.sql @@ -1,10 +1,5 @@ --- etldoc: ne_global_roads_sql [label="ne_global_roads.sql", shape=note ] --- etldoc: function_ne_highway[label="FUNCTION ne_highway"] --- etldoc: ne_global_roads_sql -> function_ne_highway --- etldoc: function_ne_highway -> postgreSQL - CREATE OR REPLACE FUNCTION ne_highway(type VARCHAR) RETURNS VARCHAR AS $$ SELECT CASE type WHEN 'Major Highway' THEN 'motorway' @@ -15,10 +10,6 @@ CREATE OR REPLACE FUNCTION ne_highway(type VARCHAR) RETURNS VARCHAR AS $$ $$ LANGUAGE SQL IMMUTABLE; --- etldoc: natural_earth [fillcolor=lightblue, style="rounded,filled", shape=box , label="Natural Earth" ]; --- etldoc: natural_earth -> ne_10m_roads --- etldoc: natural_earth -> ne_10m_roads_north_america - -- etldoc: ne_global_roads_sql -> ne_10m_global_roads ; CREATE TABLE IF NOT EXISTS ne_10m_global_roads AS ( @@ -30,7 +21,6 @@ CREATE TABLE IF NOT EXISTS ne_10m_global_roads AS ( AND type IN ('Major Highway', 'Secondary Highway', 'Road') UNION ALL - -- etldoc: function_ne_highway -> ne_10m_global_roads -- etldoc: ne_10m_roads_north_america -> ne_10m_global_roads SELECT geom AS geometry, scalerank, ne_highway(type) AS highway FROM ne_10m_roads_north_america diff --git a/layers/highway/types.sql b/layers/highway/types.sql index a1e8443..10e6c6b 100644 --- a/layers/highway/types.sql +++ b/layers/highway/types.sql @@ -1,11 +1,6 @@ --- etldoc: types_sql[label="types.sql", shape=note ] - DO $$ --- etldoc: type_highway_class[label="TYPE highway_class"] --- etldoc: types_sql-> type_highway_class --- etldoc: type_highway_class -> postgreSQL BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'highway_class') THEN CREATE TYPE highway_class AS ENUM ('motorway', 'major_road', 'minor_road', 'path'); @@ -14,9 +9,6 @@ END $$; DO $$ --- etldoc: type_highway_properties[label="TYPE highway_properties"] --- etldoc: types_sql-> type_highway_properties --- etldoc: type_highway_properties -> postgreSQL BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'highway_properties') THEN CREATE TYPE highway_properties AS ENUM ('bridge:oneway', 'tunnel:oneway', 'ramp', 'ford', 'bridge', 'tunnel', 'oneway'); @@ -24,10 +16,6 @@ BEGIN END $$; - --- etldoc: function_to_highway_class[label="FUNCTION to_highway_class"] --- etldoc: types_sql-> function_to_highway_class --- etldoc: function_to_highway_class -> postgreSQL CREATE OR REPLACE FUNCTION to_highway_class(highway TEXT) RETURNS highway_class AS $$ SELECT CASE WHEN highway IN ('motorway', 'motorway_link') THEN 'motorway'::highway_class @@ -42,9 +30,6 @@ CREATE OR REPLACE FUNCTION to_highway_class(highway TEXT) RETURNS highway_class END; $$ LANGUAGE SQL IMMUTABLE STRICT; --- etldoc: function_to_highway_properties[label="FUNCTION to_highway_properties"] --- etldoc: types_sql-> function_to_highway_properties --- etldoc: function_to_highway_properties -> postgreSQL CREATE OR REPLACE FUNCTION to_highway_properties(is_bridge boolean, is_tunnel boolean, is_ford boolean, is_ramp boolean, is_oneway boolean) RETURNS highway_properties AS $$ SELECT CASE WHEN is_bridge AND is_oneway THEN 'bridge:oneway'::highway_properties