Refactor z12-14 transportation filter logic (#1207)

This PR is a refactor.  The purpose of this PR is to refactor the logic in the z12-z14 transportation layer to increase readability and reduce code complexity.

In addition, this fixes bugs in the original filter code:
* Create filter parity between `service` and `service_construction` highway classes.
* Removal of unintended `class` values `minor_construction`, `path_construction`, `service_construction`, and `track_construction` from zoom 12 filter by explicitly listing the highway classes that are included.
This commit is contained in:
Brian Sperlongano
2021-09-20 02:07:38 -04:00
committed by GitHub
parent d19aa5bf24
commit 849aca8da7
3 changed files with 46 additions and 21 deletions

View File

@@ -358,26 +358,17 @@ FROM (
z_order
FROM osm_highway_linestring
WHERE NOT is_area
AND (
zoom_level = 12 AND (
highway_class(highway, public_transport, construction) NOT IN ('track', 'path', 'minor', 'service')
OR highway IN ('unclassified', 'residential')
) AND man_made <> 'pier'
OR zoom_level = 13
AND (
highway_class(highway, public_transport, construction) NOT IN ('track', 'path') AND
man_made <> 'pier'
OR
man_made = 'pier' AND NOT ST_IsClosed(geometry)
)
AND service NOT IN ('driveway', 'parking_aisle')
OR zoom_level >= 14
AND (
man_made <> 'pier'
OR
NOT ST_IsClosed(geometry)
)
)
AND
CASE WHEN zoom_level = 12 THEN transportation_filter_z12(highway, construction)
WHEN zoom_level = 13 THEN
CASE WHEN man_made='pier' THEN NOT ST_IsClosed(geometry)
ELSE transportation_filter_z13(highway, public_transport, construction, service)
END
WHEN zoom_level >= 14 THEN
CASE WHEN man_made='pier' THEN NOT ST_IsClosed(geometry)
ELSE TRUE
END
END
UNION ALL
-- etldoc: osm_railway_linestring_gen_z8 -> layer_transportation:z8