Commit 4acd6c7
authored
Generalize stations using discrete isolation (#633)
Closes #555
## Goal
Improve the distribution of stations on the map for lower zoom levels,
worldwide, without cluttering the map with too many stations.
## Implementation and documentation
Method: *Discrete Isolation* to provide a measure of local importance of
a station, compared to a global importance.
See:
- https://osm2pgsql.org/doc/manual.html#strategy-discrete-isolation
-
https://blog.jochentopf.com/2022-12-19-selecting-settlements-to-display.html
- https://dx.doi.org/10.1007/s42489-021-00079-y
## Changes
The *Discrete Isolation* implementation of Osm2pgsql is used. This is
experimental but works fine.
After the station importance has been determined by the number of routes
or rail length (for yards), the discrete isolation algorithm is ran to
determine the discrete isolation column values for each station.
The discrete isolation are used to filter zooms 4 until 7, instead of
just the station importance values. The result is that huge stations
close together (e.g. in the same city) do not all show on the map in the
same location, because locally one of the stations will be the most
important.
Worldwide this makes a difference because many stations do not have many
routes like the large European stations, but do have more routes tagged
than other stations in the area, making them locally more important.
Furthermore, the requirement to have a railway reference has been
removed. For non-European stations, railway references are often not
tagged, which removed them from the map for the low zoom levels.
Zooms 3 and lower are unchanged and show no stations.
Zoom 4 shows medium and large stations without their references/names,
filtered by local importance for zoom 4.
Zoom 5 shows medium and large stations, filtered by local importance for
zoom 5.
Zoom 6 shows medium and large stations, filtered by local importance for
zoom 6.
Zoom 7 shows all stations, filtered by local importance for zoom 7, but
no references/names for small stations.
Zoom 8 and higher shows all stations.
## Testing
Image below: master branch, https://openrailwaymap.app
Image above: this branch, http://localhost:8000
### Europe
Zoom 4 (https://openrailwaymap.app/#view=4/51.14/18.47):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/8e385e5a-c797-4ac0-b603-71fa18da1b8a"
/>
Zoom 5 (https://openrailwaymap.app/#view=5/50.88/12.49):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/275f9a50-8200-44c2-b8b9-e944308e4ceb"
/>
Zoom 6 (https://openrailwaymap.app/#view=6/49.388/7.588):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/617b168b-2187-4802-a9ce-a466489e321b"
/>
Zoom 7 (https://openrailwaymap.app/#view=7/47.657/7.751):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/8ea468da-df71-469a-a209-234e721ff02d"
/>
### East Asia
Zoom 4 (https://openrailwaymap.app/#view=4/39.06/127.17):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/bba03360-9d9e-482d-a4f4-928a32890c36"
/>
Zoom 5 (https://openrailwaymap.app/#view=5/38.49/134.36):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/b9b18f3f-c7e7-41ef-b390-8a88850cdd5e"
/>
Zoom 6 (https://openrailwaymap.app/#view=6/35.741/132.211):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/4ee196a3-ac26-478c-8e1e-f1ba8d9efceb"
/>
Zoom 7 (https://openrailwaymap.app/#view=7/34.752/134.117):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/08c3939d-a794-44cd-9a88-8ca1b74426e8"
/>
### South Asia
Zoom 4 (https://openrailwaymap.app/#view=4/19.97/86.77):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/f6a6cf0e-0dc3-4386-8bd7-fdcc46297fe8"
/>
Zoom 5 (https://openrailwaymap.app/#view=5/21.78/82.24):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/0d9307f8-31d6-420e-be3a-baa095c391b4"
/>
Zoom 6 (https://openrailwaymap.app/#view=6/25.757/80.629):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/8b919f40-d221-41e8-b3c7-4934a04e217a"
/>
Zoom 7 (https://openrailwaymap.app/#view=7/22.007/74.38):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/487925aa-cc8f-4e80-9da3-3dc55c8625f1"
/>
### South America
Zoom 4 (https://openrailwaymap.app/#view=4/-34.87/-58.21):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/5e873a01-7972-4bfb-91cd-35b555c687f1"
/>
Zoom 5 (https://openrailwaymap.app/#view=5/-34.65/-62.82):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/74b72599-171a-4524-bb57-bebf0f906f21"
/>
Zoom 6 (https://openrailwaymap.app/#view=6/-33.533/-61.109):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/3495ceed-41de-47cd-ab70-2a4329c5eda3"
/>
Zoom 7 (https://openrailwaymap.app/#view=7/-34.062/-60.466):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/d2daa8d4-7a4a-4454-b0b9-e028391ff190"
/>
### North America
Zoom 4 (https://openrailwaymap.app/#view=4/38.16/-88.29):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/e332bcd7-64d2-4cac-b69e-5ca2697daffd"
/>
Zoom 5 (https://openrailwaymap.app/#view=5/39.85/-80.27):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/c681be9a-9517-4600-84b5-b826457bc3fb"
/>
Zoom 6 (https://openrailwaymap.app/#view=6/42.238/-83.259):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/975dbfed-8302-4c95-b230-39b0fb4ee0cd"
/>
Zoom 7 (https://openrailwaymap.app/#view=7/41.893/-85.488):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/dcf14865-3ac3-4b96-b83c-73a1fa9d151b"
/>
### Africa
Zoom 4 (https://openrailwaymap.app/#view=4/-27.11/29.33):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/cbc5a110-4c12-4f6d-897b-1f00ff3ce8da"
/>
Zoom 5 (https://openrailwaymap.app/#view=5/-29.81/25.02):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/012b08e7-689f-4392-8542-7a42e09e4709"
/>
Zoom 6 (https://openrailwaymap.app/#view=6/-27.548/28.778):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/b5409dc7-bcad-46fe-8e98-e4f67ebdb600"
/>
Zoom 7 (https://openrailwaymap.app/#view=7/-26.916/28.831):
<img width="1227" height="1395" alt="image"
src="https://github.com/user-attachments/assets/85f95c35-3ae3-4f01-81ab-d48252f9f147"
/>
## Future
Stations should not be rendered for low zooms if they are not on
main/branch lines, and for non-train modalities. There is much missing
tagging in some regions of the world. See e.g.
#663.
With more stop areas and routes tagged, the importance of a station is
clearer to determine worldwide. Some future tweaking of the discrete
isolation output values might be needed.1 parent 65aec5f commit 4acd6c7
File tree
10 files changed
+229
-179
lines changed- api/test
- import
- sql
- test
- proxy/js
10 files changed
+229
-179
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| |||
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
95 | 104 | | |
96 | 105 | | |
97 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1254 | 1254 | | |
1255 | 1255 | | |
1256 | 1256 | | |
1257 | | - | |
| 1257 | + | |
1258 | 1258 | | |
1259 | 1259 | | |
1260 | 1260 | | |
| |||
1478 | 1478 | | |
1479 | 1479 | | |
1480 | 1480 | | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 106 | + | |
166 | 107 | | |
167 | 108 | | |
168 | | - | |
| 109 | + | |
169 | 110 | | |
170 | 111 | | |
171 | 112 | | |
| |||
191 | 132 | | |
192 | 133 | | |
193 | 134 | | |
194 | | - | |
| 135 | + | |
195 | 136 | | |
196 | 137 | | |
197 | 138 | | |
| |||
210 | 151 | | |
211 | 152 | | |
212 | 153 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
0 commit comments