Skip to content

Commit fe34635

Browse files
feat: offer Nominatim entrance nodes as routing targets
A geocoded place drops its waypoint on the centroid, which for a large site is nowhere a traveller can reach: BER's centroid sits on the airfield, 1.5 km from the terminal doors, and the route ends on a slip road. Nominatim reports a place's entrance nodes when asked (`entrances=1`), so they are now offered as an alternative. Clicking a door routes to it while the waypoint's pin stays on the place that was searched for, joined by a dashed line. Every door stays on the map, the chosen one marked, and clicking it again routes back to the place. The picker never chooses for the user. `entrance=main` records how a building is laid out, not what a router can reach — the Pergamonmuseum tags a main door the walking network stops 90 m short of, while its side door is on the path — so acting on the tag would be confidently wrong about as often as right. Which doors are offered depends on two things: - Direction, from the wiki's one-way values. `entrance=exit` is "a one-way out" and so only usable at an origin; `entrance=entrance` is "a one-way in" and only at a destination. A via point is both arrived at and left from, so it takes neither. - The travel mode, from the door's own OSM access tags, following the access hierarchy (`motor_vehicle` > `vehicle` > `access`). Read live, so switching profile re-applies the rules to what is on screen. Doors are named from their OSM `name` tag where they have one, and labelled permanently. Where labels collide the whole colliding run collapses into one listing every door in it; zooming in separates them again. Labels live in a pane below the marker pane, because Leaflet derives a marker's z-index from its latitude and a zIndexOffset alone cannot keep a dot above them. Also here: - The site outline is drawn beneath the doors, fetched only when the picker opens. It is thinned with Visvalingam-Whyatt, stopping as soon as the smallest surviving triangle would be visible, rather than with Nominatim's polygon_threshold: that tolerance is absolute degrees, so a value that usefully thins a 5 km airport flattens a 170 m building into five stray corners. - The gap between where a route can reach and its waypoint is now dashed throughout. Leaflet Routing Machine's default draws it as a solid casing with dashes on top, which against this app's heavy blue route reads as more route. - `continue_straight=true`, so OSRM leaves a via point by a different way instead of doubling back. Measured at 1575 m against 1524 m on a via at Hardenbergstrasse 36; a no-op without via points, and it still routes where the u-turn is unavoidable. - The persisted geocode cache moves to v2: entries predate the entrance data, the OSM identifiers and the access tags. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 0e067ab commit fe34635

18 files changed

Lines changed: 3923 additions & 40 deletions

css/site.css

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,3 +1118,81 @@ td.distance {
11181118
pointer-events: none;
11191119
z-index: 1000;
11201120
}
1121+
1122+
/* Entrance picker — alternative positions offered for a geocoded place.
1123+
Nominatim gives entrance nodes no name or ref, so the dot's position on the
1124+
map is the only thing that tells one apart from another. They are deliberately
1125+
smaller and flatter than the A/B waypoint pins: the pin shows where the route
1126+
actually starts, these only show where it could be moved to. */
1127+
.osrm-entrance-marker {
1128+
box-sizing: border-box;
1129+
width: 18px;
1130+
height: 18px;
1131+
border-radius: 50%;
1132+
border: 3px solid #fff;
1133+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
1134+
cursor: pointer;
1135+
transition: transform 0.1s ease-out;
1136+
}
1137+
1138+
.osrm-entrance-marker:hover {
1139+
transform: scale(1.35);
1140+
}
1141+
1142+
/* A door tagged entrance=main — the one most travellers are looking for. */
1143+
.osrm-entrance-marker-main {
1144+
background-color: #2b7ac9;
1145+
}
1146+
1147+
/* Any other public entrance. */
1148+
.osrm-entrance-marker-other {
1149+
background-color: #7fb2e5;
1150+
}
1151+
1152+
/* The centroid the geocoder originally returned, kept as a choice so a waypoint
1153+
moved to an entrance can always be moved back. */
1154+
.osrm-entrance-marker-centre {
1155+
background-color: #8b8b8b;
1156+
}
1157+
1158+
/* The door the route currently runs to. Filled dark and ringed, so it reads as
1159+
chosen while every other door stays on the map and one click away. */
1160+
.osrm-entrance-marker-selected {
1161+
background-color: #022bb1;
1162+
border-color: #fff;
1163+
box-shadow: 0 0 0 3px rgba(2, 43, 177, 0.35), 0 1px 3px rgba(0, 0, 0, 0.4);
1164+
}
1165+
1166+
/* Entrance labels. Permanent, so every door names itself without being
1167+
hovered. Owned by the picker rather than drawn as Leaflet tooltips: the
1168+
tooltip pane sits above the marker pane, which would put a label over the dot
1169+
it names. As markers they share the pane with the dots, and a lower
1170+
zIndexOffset keeps every dot on top. */
1171+
.osrm-entrance-label {
1172+
/* Zero-sized, so the anchor is the door itself. */
1173+
width: 0;
1174+
height: 0;
1175+
}
1176+
1177+
.osrm-entrance-label-inner {
1178+
position: absolute;
1179+
left: 0;
1180+
bottom: 14px;
1181+
transform: translateX(-50%);
1182+
background-color: rgba(255, 255, 255, 0.94);
1183+
border-radius: 3px;
1184+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
1185+
color: #14243f;
1186+
font-size: 12px;
1187+
line-height: 1.35;
1188+
padding: 3px 7px;
1189+
pointer-events: none;
1190+
white-space: nowrap;
1191+
}
1192+
1193+
/* A merged label lists one door per line, so it cannot stay on one. */
1194+
.osrm-entrance-label-merged .osrm-entrance-label-inner div + div {
1195+
border-top: 1px solid rgba(20, 36, 63, 0.12);
1196+
margin-top: 2px;
1197+
padding-top: 2px;
1198+
}

i18n/de.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,12 @@ module.exports = {
1616
'Bike': 'Fahrrad',
1717
'Car': 'Auto',
1818
'Foot': 'Fussgänger',
19+
'Main entrance': 'Haupteingang',
20+
'Entrance': 'Eingang',
21+
'Centre of place': 'Ortsmitte',
22+
'main entrance': 'Haupteingang',
23+
'entrance': 'Eingang',
24+
'Exit': 'Ausgang',
25+
'exit': 'Ausgang',
1926
'Build': 'Build: '
2027
};

i18n/en.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,12 @@ module.exports = {
1616
'Bike': 'Bike',
1717
'Car': 'Car',
1818
'Foot': 'Foot',
19+
'Main entrance': 'Main entrance',
20+
'Entrance': 'Entrance',
21+
'Centre of place': 'Centre of place',
22+
'main entrance': 'main entrance',
23+
'entrance': 'entrance',
24+
'Exit': 'Exit',
25+
'exit': 'exit',
1926
'Build': 'Build: '
2027
};

0 commit comments

Comments
 (0)