feat(junction): project advanced facilities and associations
This commit is contained in:
1 parent
61ae90352a
commit
0065c3eaec
9 files changed
+111
-3
No files matched your search
@@ -56,6 +56,10 @@ function projectJunctionStructure({
|
||||
? 'two-way'
|
||||
: 'unknown',
|
||||
carriageway: { laneCount: Number(road.laneCount) || 0, effectiveWidthMeters: Number(road.widthMeters) || 0 },
|
||||
pedestrian: {
|
||||
connected: Boolean(road.sidewalkLeft || road.sidewalkRight),
|
||||
bicycleConnected: ['cycleway', 'path', 'living_street'].includes(String(road.highway || '').toLowerCase()),
|
||||
},
|
||||
geometryRef: String(road.id || `road:${index + 1}`),
|
||||
sourceRoadId: String(road.id || ''),
|
||||
};
|
||||
@@ -75,6 +79,7 @@ function projectJunctionStructure({
|
||||
})
|
||||
: [];
|
||||
const facilities = [];
|
||||
const crossingKeys = [];
|
||||
for (const [kind, collection] of [
|
||||
['crossing', layers.crosswalks],
|
||||
['stop-line', layers.vehicleStopLines],
|
||||
@@ -87,11 +92,41 @@ function projectJunctionStructure({
|
||||
label: kind === 'crossing' ? `人行横道 ${index + 1}` : `停止线 ${index + 1}`,
|
||||
geometryRef: String(id),
|
||||
});
|
||||
if (kind === 'crossing') crossingKeys.push(String(id));
|
||||
});
|
||||
}
|
||||
for (const [index, feature] of featureCollection(trafficSignals?.assemblies).entries()) {
|
||||
const id = feature.properties?.signal_uid || feature.properties?.id || `signal:${index + 1}`;
|
||||
facilities.push({ key: String(id), kind: 'signal', label: `信号灯 ${index + 1}`, geometryRef: String(id) });
|
||||
const signalNode = feature.properties?.node_id || feature.properties?.control_id;
|
||||
const related = crossingKeys.find((crossingKey) => String(crossingKey).includes(String(signalNode || '')));
|
||||
facilities.push({
|
||||
key: String(id),
|
||||
kind: 'signal',
|
||||
label: `信号灯 ${index + 1}`,
|
||||
geometryRef: String(id),
|
||||
...(related ? { relatedFacilityKey: related } : {}),
|
||||
});
|
||||
}
|
||||
for (const [kind, collection] of [
|
||||
['island', layers.islands],
|
||||
['median', layers.medians],
|
||||
['sidewalk-turn', layers.sidewalkTurns],
|
||||
]) {
|
||||
featureCollection(collection).forEach((feature, index) => {
|
||||
if (feature.properties?.kind !== kind) return;
|
||||
const id = feature.properties?.native_id || feature.properties?.id || `${kind}:${index + 1}`;
|
||||
facilities.push({
|
||||
key: String(id),
|
||||
kind,
|
||||
label:
|
||||
kind === 'island'
|
||||
? `导流岛 ${index + 1}`
|
||||
: kind === 'median'
|
||||
? `中央分隔 ${index + 1}`
|
||||
: `人行道转角 ${index + 1}`,
|
||||
geometryRef: String(id),
|
||||
});
|
||||
});
|
||||
}
|
||||
const shapeKind =
|
||||
shape?.kind ||
|
||||
|
||||
Reference in new issue
Block a user