Skip to content

Commit

Permalink
Import and display track class (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddewie authored Nov 16, 2024
1 parent cfd1f60 commit 694b5d6
Show file tree
Hide file tree
Showing 9 changed files with 400 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,21 @@ loading_gauges:

Open a pull request where you provide details about the new loading gauge. Ensure the pull request contains references to documentation and places on the map where the loading gauge exists.

## I want to visualize a new track class on the map

Edit the file [`features/track_class.yaml`](https://github.com/hiddewie/OpenRailwayMap-vector/edit/master/features/track_class.yaml).

The file contains a list of track classes, each with a value (the value of the `railway:track_class` tag) and a color.

Add a new entry at a certain place in the list. The value is the `railway:track_class` tag value. For example:
```yaml
track_classes:
- { value: 'Z', color: 'blue' }
# ...
```

Open a pull request where you provide details about the new track class. Ensure the pull request contains references to documentation and places on the map where the track class exists.

## I want to improve the user interface

The HTML, Javascript and CSS of the user interface are located in the [proxy](https://github.com/hiddewie/OpenRailwayMap-vector/tree/master/proxy) directory.
Expand Down
32 changes: 32 additions & 0 deletions features/track_class.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
track_classes:
- { value: 'A', color: 'hsl(248, 100%, 40%)' }
- { value: 'B1', color: 'hsl(220, 100%, 40%)' }
- { value: 'B2', color: 'hsl(200, 100%, 40%)' }
- { value: 'C2', color: 'hsl(180, 100%, 40%)' }
- { value: 'C3', color: 'hsl(160, 100%, 40%)' }
- { value: 'C3L', color: 'hsl(140, 100%, 40%)' }
- { value: 'C4', color: 'hsl(120, 100%, 40%)' }
- { value: 'CE', color: 'hsl(100, 100%, 40%)' }
- { value: 'CM2', color: 'hsl(80, 100%, 40%)' }
- { value: 'CM3', color: 'hsl(60, 100%, 40%)' }
- { value: 'CM', color: 'hsl(40, 100%, 40%)' }
- { value: 'D2', color: 'hsl(30, 100%, 40%)' }
- { value: 'D3', color: 'hsl(20, 100%, 40%)' }
- { value: 'D4', color: 'hsl(10, 100%, 40%)' }
- { value: 'DL', color: 'hsl(0, 100%, 40%)' }
- { value: 'E4', color: 'hsl(340, 100%, 40%)' }
- { value: 'E5', color: 'hsl(320, 100%, 40%)' }
- { value: 'F', color: 'hsl(300, 100%, 40%)' }
- { value: 'G', color: 'hsl(280, 100%, 40%)' }
- { value: '1', color: 'hsl(240, 100%, 40%)' }
- { value: '2', color: 'hsl(210, 100%, 40%)' }
- { value: '3', color: 'hsl(180, 100%, 40%)' }
- { value: '4', color: 'hsl(150, 100%, 40%)' }
- { value: '5', color: 'hsl(120, 100%, 40%)' }
- { value: '6', color: 'hsl(90, 100%, 40%)' }
- { value: '7', color: 'hsl(60, 100%, 40%)' }
- { value: '8', color: 'hsl(30, 100%, 40%)' }
- { value: '9', color: 'hsl(0, 100%, 40%)' }
- { value: '10', color: 'hsl(330, 100%, 40%)' }
- { value: '11', color: 'hsl(300, 100%, 40%)' }
- { value: 'excepted', color: 'black' }
2 changes: 2 additions & 0 deletions import/openrailwaymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ local railway_line = osm2pgsql.define_table({
{ column = 'future_voltage', type = 'integer' },
{ column = 'gauges', sql_type = 'text[]' },
{ column = 'loading_gauge', sql_type = 'text' },
{ column = 'track_class', sql_type = 'text' },
{ column = 'reporting_marks', sql_type = 'text[]' },
{ column = 'construction_railway', type = 'text' },
{ column = 'proposed_railway', type = 'text' },
Expand Down Expand Up @@ -591,6 +592,7 @@ function osm2pgsql.process_way(object)
future_voltage = future_voltage,
gauges = '{' .. table.concat(gauges, ',') .. '}',
loading_gauge = tags['loading_gauge'],
track_class = tags['railway:track_class'],
reporting_marks = '{' .. table.concat(reporting_marks, ',') .. '}',
construction_railway = tags['construction:railway'],
proposed_railway = tags['proposed:railway'],
Expand Down
2 changes: 2 additions & 0 deletions import/sql/tile_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CREATE OR REPLACE VIEW railway_line_high AS
END AS standard_label,
ref,
track_ref,
track_class,
array_to_string(reporting_marks, ', ') as reporting_marks,
preferred_direction,
CASE
Expand Down Expand Up @@ -85,6 +86,7 @@ CREATE OR REPLACE VIEW railway_line_high AS
bridge,
tunnel,
track_ref,
track_class,
ref,
CASE
WHEN railway = 'abandoned' THEN railway_label_name(COALESCE(abandoned_name, name), tunnel, tunnel_name, bridge, bridge_name)
Expand Down
3 changes: 3 additions & 0 deletions martin/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ postgres:
gaugeint2: number
gauge_label: string
loading_gauge: string
track_class: string
reporting_marks: string

railway_line_med:
Expand Down Expand Up @@ -104,6 +105,7 @@ postgres:
gaugeint2: number
gauge_label: string
loading_gauge: string
track_class: string
reporting_marks: string

railway_line_high:
Expand Down Expand Up @@ -145,6 +147,7 @@ postgres:
gaugeint2: number
gauge_label: string
loading_gauge: string
track_class: string
reporting_marks: string

# --- Standard --- #
Expand Down
1 change: 1 addition & 0 deletions proxy.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN --mount=type=bind,source=proxy/js/styles.mjs,target=styles.mjs \
--mount=type=bind,source=features/electrification_signals.yaml,target=electrification_signals.yaml \
--mount=type=bind,source=features/signals_railway_signals.yaml,target=signals_railway_signals.yaml \
--mount=type=bind,source=features/loading_gauge.yaml,target=loading_gauge.yaml \
--mount=type=bind,source=features/track_class.yaml,target=track_class.yaml \
node /build/styles.mjs

FROM nginx:1-alpine
Expand Down
Loading

0 comments on commit 694b5d6

Please sign in to comment.