Reduce classes to major
This commit is contained in:
parent
ea2530788f
commit
c1b1e980ed
@ -1,14 +1,14 @@
|
|||||||
DO $$
|
DO $$
|
||||||
BEGIN
|
BEGIN
|
||||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'highway_class') THEN
|
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'highway_class') THEN
|
||||||
CREATE TYPE highway_class AS ENUM ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'minor_road', 'path');
|
CREATE TYPE highway_class AS ENUM ('motorway', 'major_road', 'minor_road', 'path');
|
||||||
END IF;
|
END IF;
|
||||||
END
|
END
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
DO $$
|
DO $$
|
||||||
BEGIN
|
BEGIN
|
||||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'highway_class') THEN
|
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');
|
CREATE TYPE highway_properties AS ENUM ('bridge:oneway', 'tunnel:oneway', 'ramp', 'ford', 'bridge', 'tunnel', 'oneway');
|
||||||
END IF;
|
END IF;
|
||||||
END
|
END
|
||||||
@ -18,10 +18,11 @@ $$;
|
|||||||
CREATE OR REPLACE FUNCTION to_highway_class(highway TEXT) RETURNS highway_class AS $$
|
CREATE OR REPLACE FUNCTION to_highway_class(highway TEXT) RETURNS highway_class AS $$
|
||||||
SELECT CASE
|
SELECT CASE
|
||||||
WHEN highway IN ('motorway', 'motorway_link') THEN 'motorway'::highway_class
|
WHEN highway IN ('motorway', 'motorway_link') THEN 'motorway'::highway_class
|
||||||
WHEN highway IN ('trunk', 'trunk_link') THEN 'trunk'::highway_class
|
-- A major class is helpful in styling - one can still differentiate on a finer level using the subclass
|
||||||
WHEN highway IN ('primary', 'primary_link') THEN 'primary'::highway_class
|
WHEN highway IN ('trunk', 'trunk_link',
|
||||||
WHEN highway IN ('secondary', 'secondary_link') THEN 'secondary'::highway_class
|
'primary', 'primary_link',
|
||||||
WHEN highway IN ('tertiary', 'tertiary_link') THEN 'tertiary'::highway_class
|
'secondary', 'secondary_link',
|
||||||
|
'tertiary', 'tertiary_link') THEN 'major_road'::highway_class
|
||||||
WHEN highway IN ('unclassified', 'residential', 'living_street', 'road', 'track', 'service') THEN 'minor_road'::highway_class
|
WHEN highway IN ('unclassified', 'residential', 'living_street', 'road', 'track', 'service') THEN 'minor_road'::highway_class
|
||||||
WHEN highway IN ('pedestrian', 'path', 'footway', 'cycleway', 'steps') THEN 'path'::highway_class
|
WHEN highway IN ('pedestrian', 'path', 'footway', 'cycleway', 'steps') THEN 'path'::highway_class
|
||||||
ELSE NULL
|
ELSE NULL
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user