Skip to content

Commit

Permalink
Merge tag 'v5.9.0' into upstream-split
Browse files Browse the repository at this point in the history
Tag v5.9.0
  • Loading branch information
giggls committed Oct 25, 2024
2 parents fb956ad + 491bd4a commit 8de9615
Show file tree
Hide file tree
Showing 21 changed files with 410 additions and 313 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ jobs:
osm2pgsql -G --hstore --style openstreetmap-carto.style --tag-transform-script openstreetmap-carto.lua -d gis -r xml <(echo '<osm version="0.6"/>')
- name: Create indexes
run: psql -1Xq -v ON_ERROR_STOP=1 -d gis -f indexes.sql
- name: Load functions
run: psql -1Xq -v ON_ERROR_STOP=1 -d gis -f functions.sql
- name: Load empty shapefiles
run: scripts/get-external-data.py --no-update --cache -D scripts/empty_files
- name: Test queries are valid
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
## [Unreleased](https://github.com/gravitystorm/openstreetmap-carto/compare/v5.8.0...master)
## [Unreleased](https://github.com/gravitystorm/openstreetmap-carto/compare/v5.9.0...master)

## [v5.9.0](https://github.com/gravitystorm/openstreetmap-carto/compare/v5.8.0...v5.9.0) - 2024-10-17
### Changes
- Adding rendering of shop=hearing_aids with a dedicated symbol (#4909)
- Restoring rendering of name labels for natural=reef (#4918)
- Adding rendering of lines with barrier=jersey_barrier (#4923)
- Removing rendering of railway=preserved in favor of interpreting railway:preserved=yes on other railway=* (#4965)
- Removing rendering of shop=jewellery as synonym for shop=jewelry (#4988)
- Adding rendering of leisure=dance with a point symbol and label (#4996)
- Interpretation of transport mode specific access tags on roads/paths (#4952)

## [v5.8.0](https://github.com/gravitystorm/openstreetmap-carto/compare/v5.7.0...v5.8.0) - 2023-11-26
### Changes
Expand Down
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,27 @@ instead of
}
}
```
* Use the PostgreSQL quoting syntax for attributes (columns) and string-values of selectors.
Use no quotes or double quotes for attributes (columns) and single quotes for string-values.
For Example:

```mss
#layer[entrance = 'yes'] {
marker-width: 6.0;
}
#layer["generator:source" = 'wind'] {
marker-width: 8.0;
}
```
instead of
```mss
#layer[entrance = "yes"] {
marker-width: 6.0;
}
#layer['generator:source' = 'wind'] {
marker-width: 8.0;
}
```

## SQL style guidelines
Because SQL within JSON or YAML will not generally be syntax highlighted, indentation and caps are particularly important.
Expand Down
7 changes: 7 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ The indexes can be created in parallel with
scripts/indexes.py -0 | xargs -0 -P0 -I{} psql -d gis -c "{}"
```

### Database functions
Some functions need to be loaded into the database for current versions. These can be added / re-loaded at any point using:

```sh
psql -d gis -f functions.sql
```

## Scripted download
Some features are rendered using preprocessed shapefiles.

Expand Down
74 changes: 74 additions & 0 deletions functions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* Additional database functions for openstreetmap-carto */

/* Access functions below adapted from https://github.com/imagico/osm-carto-alternative-colors/tree/591c861112b4e5d44badd108f4cd1409146bca0b/sql/roads.sql */

/* Simplified 'yes', 'destination', 'no', 'unrecognised', NULL scale for access restriction
'no' is returned if the rendering for highway category does not support 'restricted'.
NULL is functionally equivalent to 'yes', but indicates the absence of a restriction
rather than a positive access = yes. 'unrecognised' corresponds to an uninterpretable
access restriction e.g. access=unknown or motorcar=occasionally */
CREATE OR REPLACE FUNCTION carto_int_access(accessvalue text, allow_restricted boolean)
RETURNS text
LANGUAGE SQL
IMMUTABLE PARALLEL SAFE
AS $$
SELECT
CASE
WHEN accessvalue IN ('yes', 'designated', 'permissive') THEN 'yes'
WHEN accessvalue IN ('destination', 'delivery', 'customers') THEN
CASE WHEN allow_restricted = TRUE THEN 'restricted' ELSE 'yes' END
WHEN accessvalue IN ('no', 'permit', 'private', 'agricultural', 'forestry', 'agricultural;forestry') THEN 'no'
WHEN accessvalue IS NULL THEN NULL
ELSE 'unrecognised'
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_type(bicycle text, horse text)
RETURNS text
LANGUAGE SQL
IMMUTABLE PARALLEL SAFE
AS $$
SELECT
CASE
WHEN bicycle IN ('designated') THEN 'cycleway'
WHEN horse IN ('designated') THEN 'bridleway'
ELSE 'path'
END
$$;

/* Return int_access value which will be used to determine access marking.
Return values are documented above for carto_int_access function.
Note that the code handling the promotion of highway=path assumes that
promotion to cycleway or bridleway is based on the value of bicycle or
horse respectively. A more general formulation would be, for example,
WHEN 'cycleway' THEN carto_int_access(COALESCE(NULLIF(bicycle, 'unknown'), "access"), FALSE) */
CREATE OR REPLACE FUNCTION carto_highway_int_access(highway text, "access" text, foot text, bicycle text, horse text, motorcar text, motor_vehicle text, vehicle text)
RETURNS text
LANGUAGE SQL
IMMUTABLE PARALLEL SAFE
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
carto_int_access(
COALESCE(
NULLIF(motorcar, 'unknown'),
NULLIF(motor_vehicle, 'unknown'),
NULLIF(vehicle, 'unknown'),
"access"), TRUE)
WHEN highway = 'path' THEN
CASE carto_path_type(bicycle, horse)
WHEN 'cycleway' THEN carto_int_access(bicycle, FALSE)
WHEN 'bridleway' THEN carto_int_access(horse, FALSE)
ELSE carto_int_access(COALESCE(NULLIF(foot, 'unknown'), "access"), FALSE)
END
WHEN highway IN ('pedestrian', 'footway', 'steps') THEN carto_int_access(COALESCE(NULLIF(foot, 'unknown'), "access"), FALSE)
WHEN highway = 'cycleway' THEN carto_int_access(COALESCE(NULLIF(bicycle, 'unknown'), "access"), FALSE)
WHEN highway = 'bridleway' THEN carto_int_access(COALESCE(NULLIF(horse, 'unknown'), "access"), FALSE)
ELSE carto_int_access("access", TRUE)
END
$$;
Loading

0 comments on commit 8de9615

Please sign in to comment.