Skip to content

Commit

Permalink
demo for approach 3 with a third class of visualization for unknown a…
Browse files Browse the repository at this point in the history
…ccess values at z18+
  • Loading branch information
imagico committed May 7, 2024
1 parent 42a9e75 commit 987310a
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 9 deletions.
18 changes: 9 additions & 9 deletions functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ CREATE OR REPLACE FUNCTION carto_highway_int_highway(highway text, bicycle text,
AS $$
SELECT
CASE
WHEN highway IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary',
'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclassified', 'living_street', 'service', 'road') THEN 'road'
WHEN highway IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary',
'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclassified', 'living_street', 'service', 'road') THEN 'road'
WHEN highway IN ('footway', 'steps') THEN 'footway'
WHEN highway = 'path' THEN carto_path_type(bicycle, horse)
ELSE highway
Expand All @@ -66,14 +66,14 @@ SELECT
CASE carto_highway_int_highway(highway, bicycle, horse)
WHEN 'road' THEN
carto_int_access('road', CASE
WHEN motorcar <> 'unknown' THEN motorcar
WHEN motor_vehicle <> 'unknown' THEN motor_vehicle
WHEN vehicle <> 'unknown' THEN vehicle
WHEN motorcar IS NOT NULL THEN motorcar
WHEN motor_vehicle IS NOT NULL THEN motor_vehicle
WHEN vehicle IS NOT NULL THEN vehicle
ELSE "access" END)
WHEN 'pedestrian' THEN carto_int_access('pedestrian', CASE WHEN foot <> 'unknown' THEN foot ELSE "access" END)
WHEN 'footway' THEN carto_int_access('footway', CASE WHEN foot <> 'unknown' THEN foot ELSE "access" END)
WHEN 'cycleway' THEN carto_int_access('cycleway', CASE WHEN bicycle <> 'unknown' THEN bicycle ELSE "access" END)
WHEN 'bridleway' THEN carto_int_access('bridleway', CASE WHEN horse <> 'unknown' THEN horse ELSE "access" END)
WHEN 'pedestrian' THEN carto_int_access('pedestrian', CASE WHEN foot IS NOT NULL THEN foot ELSE "access" END)
WHEN 'footway' THEN carto_int_access('footway', CASE WHEN foot IS NOT NULL THEN foot ELSE "access" END)
WHEN 'cycleway' THEN carto_int_access('cycleway', CASE WHEN bicycle IS NOT NULL THEN bicycle ELSE "access" END)
WHEN 'bridleway' THEN carto_int_access('bridleway', CASE WHEN horse IS NOT NULL THEN horse ELSE "access" END)
ELSE carto_int_access(NULL, "access")
END
$$;
Expand Down
164 changes: 164 additions & 0 deletions style/roads.mss
Original file line number Diff line number Diff line change
Expand Up @@ -2267,6 +2267,14 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
line/line-dasharray: 2,1;
line/line-width: @steps-width-z14;
[zoom >= 15] { line/line-width: @steps-width-z15; }
[int_access = 'unknown'][zoom >= 18]
{
line/line-dasharray: 2,4;
line2/line-color: @steps-fill-noaccess;
line2/line-dasharray: 0,3,2,1;
line2/line-width: @steps-width-z14;
[zoom >= 15] { line2/line-width: @steps-width-z15; }
}
}
}

Expand All @@ -2289,6 +2297,14 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
line/line-join: round;
line/line-cap: round;
}
[int_access = 'unknown'][zoom >= 18]
{
line/line-dasharray: 4,8;
line2/line-color: @bridleway-fill-noaccess;
line2/line-dasharray: 0,6,4,2;
line2/line-width: @bridleway-width-z13;
[zoom >= 15] { line2/line-width: @bridleway-width-z15; }
}
}
}

Expand Down Expand Up @@ -2334,6 +2350,16 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[zoom >= 19] {
line/line-width: @footway-width-z19;
}
[int_access = 'unknown'][zoom >= 18]
{
line/line-dasharray: 3,9;
line2/line-color: @footway-fill-noaccess;
line2/line-dasharray: 0,6,3,3;
line2/line-join: round;
line2/line-cap: round;
line2/line-width: @footway-width-z18;
[zoom >= 19] { line2/line-width: @footway-width-z19; }
}
}
[zoom >= 15][int_surface = null] {
line/line-color: @footway-fill;
Expand All @@ -2352,6 +2378,16 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[zoom >= 19] {
line/line-width: @footway-width-z19;
}
[int_access = 'unknown'][zoom >= 18]
{
line/line-dasharray: 2,9;
line2/line-color: @footway-fill-noaccess;
line2/line-dasharray: 0,6,1,4;
line2/line-join: round;
line2/line-cap: round;
line2/line-width: @footway-width-z18;
[zoom >= 19] { line2/line-width: @footway-width-z19; }
}
}
[zoom >= 15][int_surface = 'unpaved'] {
line/line-color: @footway-fill;
Expand All @@ -2369,6 +2405,16 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[zoom >= 19] {
line/line-width: @footway-width-z19;
}
[int_access = 'unknown'][zoom >= 18]
{
line/line-dasharray: 1,9;
line2/line-color: @footway-fill-noaccess;
line2/line-dasharray: 0,5,1,4;
line2/line-join: round;
line2/line-cap: round;
line2/line-width: @footway-width-z18;
[zoom >= 19] { line2/line-width: @footway-width-z19; }
}
}
}
}
Expand Down Expand Up @@ -2414,6 +2460,16 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[zoom >= 19] {
line/line-width: @cycleway-width-z19;
}
[int_access = 'unknown'][zoom >= 18]
{
line/line-dasharray: 3,9;
line2/line-color: @cycleway-fill-noaccess;
line2/line-dasharray: 0,6,3,3;
line2/line-join: round;
line2/line-cap: round;
line2/line-width: @cycleway-width-z18;
[zoom >= 19] { line2/line-width: @cycleway-width-z19; }
}
}
[zoom >= 15][int_surface = null] {
line/line-color: @cycleway-fill;
Expand All @@ -2432,6 +2488,16 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[zoom >= 19] {
line/line-width: @cycleway-width-z19;
}
[int_access = 'unknown'][zoom >= 18]
{
line/line-dasharray: 2,9;
line2/line-color: @cycleway-fill-noaccess;
line2/line-dasharray: 0,6,1,4;
line2/line-join: round;
line2/line-cap: round;
line2/line-width: @cycleway-width-z18;
[zoom >= 19] { line2/line-width: @cycleway-width-z19; }
}
}
[zoom >= 15][int_surface = 'unpaved'] {
line/line-color: @cycleway-fill;
Expand All @@ -2449,6 +2515,16 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[zoom >= 19] {
line/line-width: @cycleway-width-z19;
}
[int_access = 'unknown'][zoom >= 18]
{
line/line-dasharray: 1,9;
line2/line-color: @cycleway-fill-noaccess;
line2/line-dasharray: 0,5,1,4;
line2/line-join: round;
line2/line-cap: round;
line2/line-width: @cycleway-width-z18;
[zoom >= 19] { line2/line-width: @cycleway-width-z19; }
}
}
}
}
Expand Down Expand Up @@ -3507,6 +3583,94 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
}
}

#roads-fill::fill,
#bridges::fill {
[int_access = 'unknown'][zoom >= 18] {
[feature = 'highway_motorway'],
[feature = 'highway_trunk'],
[feature = 'highway_primary'],
[feature = 'highway_secondary'],
[feature = 'highway_tertiary'],
[feature = 'highway_unclassified'],
[feature = 'highway_residential'],
[feature = 'highway_living_street'] {
access/line-color: @access-marking;
[feature = 'highway_tertiary'],
[feature = 'highway_unclassified'],
[feature = 'highway_residential'] {
[int_surface = 'unpaved'] {
access/line-color: @access-marking-white-unpaved;
}
}
[feature = 'highway_primary'] {
access/line-color: @access-marking-primary;
}
[feature = 'highway_secondary'] {
access/line-color: @access-marking-secondary;
}
[feature = 'highway_living_street'] {
access/line-color: @access-marking-living-street;
}
access/line-join: round;
access/line-cap: round;
access/line-width: 6;
access/line-dasharray: 10,12,0.1,12;

access2/line-color: @residential-fill;
#tunnels { access2/line-color: @residential-tunnel-fill; }
access2/line-join: round;
access2/line-cap: round;
access2/line-width: 4;
access2/line-dasharray: 10,12,0.1,12;
[feature = 'highway_motorway'] {
access2/line-color: @motorway-fill;
#tunnels { access2/line-color: @motorway-tunnel-fill; }
}
[feature = 'highway_trunk'] {
access2/line-color: @trunk-fill;
#tunnels { access2/line-color: @trunk-tunnel-fill; }
}
[feature = 'highway_primary'] {
access2/line-color: @primary-fill;
#tunnels { access2/line-color: @primary-tunnel-fill; }
}
[feature = 'highway_secondary'] {
access2/line-color: @secondary-fill;
#tunnels { access2/line-color: @secondary-tunnel-fill; }
}
[feature = 'highway_tertiary'] {
access2/line-color: @tertiary-fill;
#tunnels { access2/line-color: @tertiary-tunnel-fill; }
}
[feature = 'highway_living_street'] {
access2/line-color: @living-street-fill;
#tunnels { access2/line-color: @living-street-tunnel-fill; }
}
}
[feature = 'highway_road'],
[feature = 'highway_service'][service = 'INT-normal'] {
access/line-color: @access-marking;
[int_surface = 'unpaved'] {
access/line-color: @access-marking-white-unpaved;
}
[feature = 'highway_road'] {
access/line-color: @access-marking-road;
}
access/line-join: round;
access/line-cap: round;
access/line-width: 3;
access/line-dasharray: 8,10,0.1,10;

access2/line-color: @road-fill;
access2/line-join: round;
access2/line-cap: round;
access2/line-width: 1.5;
access2/line-dasharray: 8,10,0.1,10;
[feature = 'highway_service'] { access2/line-color: @service-fill; }
}
}
}

#guideways {
[zoom >= 11][zoom < 13] {
line-width: 0.6;
Expand Down

0 comments on commit 987310a

Please sign in to comment.