Skip to content

Commit

Permalink
Update style with fallback to public_transport value. Add tests cover…
Browse files Browse the repository at this point in the history
…ing Point/Polygon. DC example has no line data, not adding at this time. #115
  • Loading branch information
rustprooflabs committed Jul 10, 2021
1 parent 1e3706a commit b3314bf
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions flex-config/run-no-tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require "style.leisure"
require "style.natural"
require "style.place"
require "style.poi"
require "style.public_transport"
require "style.road"
require "style.shop"
require "style.traffic"
Expand Down
1 change: 1 addition & 0 deletions flex-config/run-no-tags.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
\i sql/traffic.sql
\i sql/place.sql
\i sql/poi.sql
\i sql/public_transport.sql
\i sql/road.sql
\i sql/shop.sql
\i sql/water.sql
6 changes: 3 additions & 3 deletions flex-config/sql/public_transport.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ COMMENT ON COLUMN osm.public_transport_point.geom IS 'Geometry loaded by osm2pgs
COMMENT ON COLUMN osm.public_transport_line.geom IS 'Geometry loaded by osm2pgsql.';
COMMENT ON COLUMN osm.public_transport_polygon.geom IS 'Geometry loaded by osm2pgsql.';

COMMENT ON COLUMN osm.public_transport_point.osm_type IS 'Key indicating type of public transport feature, not the public_transport tag. e.g. highway, bus, train, etc';
COMMENT ON COLUMN osm.public_transport_line.osm_type IS 'Key indicating type of public transport feature, not the public_transport tag. e.g. highway, bus, train, etc';
COMMENT ON COLUMN osm.public_transport_polygon.osm_type IS 'Key indicating type of public transport feature, not the public_transport tag. e.g. highway, bus, train, etc';
COMMENT ON COLUMN osm.public_transport_point.osm_type IS 'Key indicating type of public transport feature if detail exists, falls back to public_transport tag. e.g. highway, bus, train, etc';
COMMENT ON COLUMN osm.public_transport_line.osm_type IS 'Key indicating type of public transport feature if detail exists, falls back to public_transport tag. e.g. highway, bus, train, etc';
COMMENT ON COLUMN osm.public_transport_polygon.osm_type IS 'Key indicating type of public transport feature if detail exists, falls back to public_transport tag. e.g. highway, bus, train, etc';

COMMENT ON COLUMN osm.public_transport_point.osm_subtype IS 'Value describing osm_type key, e.g. osm_type = "highway", osm_subtype = "bus_stop".';
COMMENT ON COLUMN osm.public_transport_line.osm_subtype IS 'Value describing osm_type key, e.g. osm_type = "highway", osm_subtype = "bus_stop".';
Expand Down
2 changes: 1 addition & 1 deletion flex-config/style/public_transport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ local function get_osm_type_subtype(object)
osm_type_table['osm_type'] = 'train'
osm_type_table['osm_subtype'] = object.tags.train
else
osm_type_table['osm_type'] = 'unknown'
osm_type_table['osm_type'] = object.tags.public_transport
osm_type_table['osm_subtype'] = nil
end

Expand Down
7 changes: 7 additions & 0 deletions tests/expected/public_transport_point_osm_type_count.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bus|Metro Bus 3Y 7Y 11Y 80 S1 16Y OmniRide G MTA Commuter Bus|2
bus|yes|13
highway|bus_stop|376
platform||1
station||50
stop_position||106
train|yes|24
6 changes: 6 additions & 0 deletions tests/expected/public_transport_polygon_osm_type_count.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
platform||20
service_center||1
station||1
stop_area||1
train|yes|13
waiting_area||10
5 changes: 5 additions & 0 deletions tests/sql/public_transport_point_osm_type_count.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT osm_type COLLATE "C", osm_subtype COLLATE "C", COUNT(*)
FROM osm.public_transport_point
GROUP BY osm_type COLLATE "C", osm_subtype COLLATE "C"
ORDER BY osm_type COLLATE "C", osm_subtype COLLATE "C"
;
5 changes: 5 additions & 0 deletions tests/sql/public_transport_polygon_osm_type_count.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT osm_type COLLATE "C", osm_subtype COLLATE "C", COUNT(*)
FROM osm.public_transport_polygon
GROUP BY osm_type COLLATE "C", osm_subtype COLLATE "C"
ORDER BY osm_type COLLATE "C", osm_subtype COLLATE "C"
;

0 comments on commit b3314bf

Please sign in to comment.