Skip to content

Commit

Permalink
Add carto_path_primary_path
Browse files Browse the repository at this point in the history
  • Loading branch information
dch0ph committed Apr 13, 2024
1 parent 9c8098b commit a413991
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ SELECT
END
$$;

/* Try to promote path to cycleway (if bicycle allowed), then bridleway (if horse)
This duplicates existing behaviour where designated access is required */
CREATE OR REPLACE FUNCTION carto_path_primary_mode(bicycle text, horse text)
RETURNS text
LANGUAGE SQL
IMMUTABLE PARALLEL SAFE
AS $$
SELECT
CASE
WHEN bicycle IN ('designated') THEN 'bicycle'
WHEN horse IN ('designated') THEN 'horse'
ELSE 'foot'
END
END
$$;

/* Classify highways into access categories which will be treated in the same way
Default is NULL in which case only the access tag will be used (e.g. highway=track)
Note that bicycle, horse arguments are only relevant if considering highway=path */
Expand Down

0 comments on commit a413991

Please sign in to comment.