diff --git a/layers/highway/highway.sql b/layers/highway/highway.sql index 10f6d089..c3c2daec 100644 --- a/layers/highway/highway.sql +++ b/layers/highway/highway.sql @@ -34,15 +34,27 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class highway_class, subclass te UNION ALL SELECT osm_id, geometry, highway, is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, z_order FROM osm_highway_linestring - WHERE zoom_level = 12 AND to_highway_class(highway) < 'minor_road'::highway_class AND NOT highway_is_link(highway) + WHERE zoom_level = 12 + AND to_highway_class(highway) < 'minor_road'::highway_class + AND NOT highway_is_link(highway) + AND NOT is_area UNION ALL SELECT osm_id, geometry, highway, is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, z_order FROM osm_highway_linestring - WHERE zoom_level = 13 AND to_highway_class(highway) < 'path'::highway_class + WHERE zoom_level = 13 + AND to_highway_class(highway) < 'path'::highway_class + AND NOT is_area UNION ALL 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 + WHERE zoom_level >= 14 AND NOT is_area + UNION ALL + -- 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 + 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 + WHERE zoom_level BETWEEN 13 AND 14 AND is_area AND COALESCE(layer, 0) >= 0 ) AS zoom_levels WHERE geometry && bbox ORDER BY z_order ASC; diff --git a/layers/highway/mapping.yaml b/layers/highway/mapping.yaml index aa8c02fa..b11bb572 100644 --- a/layers/highway/mapping.yaml +++ b/layers/highway/mapping.yaml @@ -1,19 +1,19 @@ generalized_tables: highway_linestring_gen4: source: highway_linestring_gen3 - sql_filter: highway IN ('motorway','trunk') + sql_filter: highway IN ('motorway','trunk') AND NOT is_area tolerance: 200.0 highway_linestring_gen3: source: highway_linestring_gen2 - sql_filter: highway IN ('motorway','trunk', 'primary') + sql_filter: highway IN ('motorway','trunk', 'primary') AND NOT is_area tolerance: 120.0 highway_linestring_gen2: source: highway_linestring_gen1 - sql_filter: highway IN ('motorway','trunk', 'primary', 'secondary') + sql_filter: highway IN ('motorway','trunk', 'primary', 'secondary') AND NOT is_area tolerance: 50.0 highway_linestring_gen1: source: highway_linestring - sql_filter: highway IN ('motorway','trunk', 'primary', 'secondary', 'tertiary') + sql_filter: highway IN ('motorway','trunk', 'primary', 'secondary', 'tertiary') AND NOT is_area tolerance: 20.0 tables: highway_linestring: @@ -31,6 +31,9 @@ tables: type: string - name: z_order type: wayzorder + - name: layer + key: layer + type: integer - key: tunnel name: is_tunnel type: bool @@ -77,9 +80,29 @@ tables: - service - path - cycleway - - steps - bridleway - footway - corridor - crossing - pedestrian + highway_polygon: + type: polygon + fields: + - name: osm_id + type: id + - name: geometry + type: geometry + - name: highway + key: highway + type: string + - name: z_order + type: wayzorder + - name: layer + key: layer + type: integer + - name: is_area + key: area + type: bool + mapping: + highway: + - pedestrian