feat(workbench): add traffic signal rotation handle
This commit is contained in:
1 parent
9b7c3d59bd
commit
caa3cb843f
4 files changed
+234
-23
No files matched your search
+10
-2
@@ -6,6 +6,7 @@ const { parseOsm } = require('./osm');
|
||||
|
||||
const EARTH_RADIUS = 6371008.8;
|
||||
const CURB_OFFSET_METERS = 5.2;
|
||||
const MAX_SIGNAL_POLE_DISTANCE_FROM_STOP_METERS = 40;
|
||||
const MAST_REACH_METERS = 4.5;
|
||||
const SIGNAL_LAYOUT = Object.freeze({
|
||||
poleHeightMeters: 6.7,
|
||||
@@ -195,6 +196,13 @@ function validateTrafficSignalFeatures(collection) {
|
||||
input.face_heading_deg == null || input.face_heading_deg === ''
|
||||
? normalizeDegrees((legacyHeading == null ? 0 : legacyHeading) + 180)
|
||||
: normalizeDegrees(number('face_heading_deg'));
|
||||
const stopLon = number('stop_lon', { min: -180, max: 180 });
|
||||
const stopLat = number('stop_lat', { min: -90, max: 90 });
|
||||
const poleDistance = metersBetween(feature.geometry.coordinates, [stopLon, stopLat]);
|
||||
if (poleDistance > MAX_SIGNAL_POLE_DISTANCE_FROM_STOP_METERS)
|
||||
throw new Error(
|
||||
`${label}: signal pole is ${Math.round(poleDistance)}m from its stop line (maximum ${MAX_SIGNAL_POLE_DISTANCE_FROM_STOP_METERS}m)`,
|
||||
);
|
||||
return {
|
||||
type: 'Feature',
|
||||
geometry: { type: 'Point', coordinates: feature.geometry.coordinates.slice(0, 2).map(Number) },
|
||||
@@ -212,8 +220,8 @@ function validateTrafficSignalFeatures(collection) {
|
||||
face_heading_deg: faceHeading,
|
||||
phase_group: phaseGroup,
|
||||
mast_reach_m: number('mast_reach_m', { min: 0.1, max: 30 }),
|
||||
stop_lon: number('stop_lon', { min: -180, max: 180 }),
|
||||
stop_lat: number('stop_lat', { min: -90, max: 90 }),
|
||||
stop_lon: stopLon,
|
||||
stop_lat: stopLat,
|
||||
enabled,
|
||||
z_offset_m: number('z_offset_m', { min: -20, max: 100 }),
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user