feat: generate direct edit handle manifest
This commit is contained in:
1 parent
3297d0c97a
commit
ab63d23896
6 files changed
+501
-35
No files matched your search
+20
-14
@@ -5,6 +5,16 @@ const path = require('path');
|
||||
const { arrowRingsAt, normalizeManeuver } = require('./turn-lane-arrows');
|
||||
const { buildComplexJunctionGeometry, complexJunctionMetrics } = require('./complex-junction');
|
||||
const { diagnostic } = require('./diagnostics');
|
||||
const {
|
||||
roadSurfaceId,
|
||||
sidewalkId,
|
||||
laneId,
|
||||
laneSeparatorId,
|
||||
edgeLineId,
|
||||
centerLineId,
|
||||
junctionSurfaceId,
|
||||
connectionConnectorId,
|
||||
} = require('./native-ids');
|
||||
|
||||
const OVERRIDE_SCHEMA = 'native-road-overrides/v1';
|
||||
const MOTOR_HIGHWAYS = new Set([
|
||||
@@ -676,9 +686,7 @@ function compileGeometry(model, overrides = { overrides: [] }, options = {}) {
|
||||
);
|
||||
continue;
|
||||
}
|
||||
const surfaceId = road.segmentId.endsWith('/0')
|
||||
? `surface:way/${road.osmWayIds.join(',')}`
|
||||
: `surface:${segmentKey}`;
|
||||
const surfaceId = roadSurfaceId(road);
|
||||
features.push({
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
@@ -996,7 +1004,7 @@ function edgeLineFeature(road, side, style, ring, part = null) {
|
||||
return {
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
native_id: `edge-line:${road.id}:${side}${part ? `:${part}` : ''}`,
|
||||
native_id: edgeLineId(road.id, side, part),
|
||||
road_id: road.id,
|
||||
side,
|
||||
osm_way_ids: road.osmWayIds.join(','),
|
||||
@@ -1081,7 +1089,7 @@ function compileCenterLines(model, overrides, junctionPlans, controls, diagnosti
|
||||
features.push({
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
native_id: `center-line:${segmentId}:${dashIndex}:${offset}`,
|
||||
native_id: `${centerLineId(segmentId)}:${dashIndex}:${offset}`,
|
||||
segment_id: segmentId,
|
||||
road_id: forward.id,
|
||||
cluster_id: cluster?.id || null,
|
||||
@@ -1317,7 +1325,7 @@ function compileLaneMarkings(model, overrides, lanes, diagnostics, junctionPlans
|
||||
if (ring)
|
||||
separators.push({
|
||||
type: 'Feature',
|
||||
properties: { native_id: `lane-separator:${road.id}:${index}-${index + 1}`, ...properties },
|
||||
properties: { native_id: laneSeparatorId(road.id, index), ...properties },
|
||||
geometry: { type: 'Polygon', coordinates: [ring] },
|
||||
});
|
||||
} else {
|
||||
@@ -1336,7 +1344,7 @@ function compileLaneMarkings(model, overrides, lanes, diagnostics, junctionPlans
|
||||
);
|
||||
separators.push({
|
||||
type: 'Feature',
|
||||
properties: { native_id: `lane-separator:${road.id}:${index}-${index + 1}:${part}`, ...properties },
|
||||
properties: { native_id: `${laneSeparatorId(road.id, index)}:${part}`, ...properties },
|
||||
geometry: { type: 'Polygon', coordinates: [ring] },
|
||||
});
|
||||
}
|
||||
@@ -1605,13 +1613,11 @@ function compileSidewalkSurfaces(model, diagnostics, junctionPlans, options = {}
|
||||
);
|
||||
continue;
|
||||
}
|
||||
const sidewalkId = forward.segmentId.endsWith('/0')
|
||||
? `sidewalk:way/${forward.osmWayIds.join(',')}:${side}`
|
||||
: `sidewalk:${wayKey}:${side}`;
|
||||
const sidewalkNativeId = sidewalkId(forward, side);
|
||||
features.push({
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
native_id: sidewalkId,
|
||||
native_id: sidewalkNativeId,
|
||||
cluster_id: cluster?.id || null,
|
||||
osm_way_ids: forward.osmWayIds.join(','),
|
||||
source_road_id: forward.sourceRoadId,
|
||||
@@ -1884,7 +1890,7 @@ function compileLaneCenterlines(model, diagnostics, junctionPlans, options = {},
|
||||
);
|
||||
continue;
|
||||
}
|
||||
const lane = { id: `lane:${road.id}:${index + 1}`, roadId: road.id, index: index + 1, coordinates };
|
||||
const lane = { id: laneId(road.id, index + 1), roadId: road.id, index: index + 1, coordinates };
|
||||
lanes.push(lane);
|
||||
// Only the published geometry stops at the crossing. `coordinates` stays
|
||||
// whole because connectors are derived from it; a lane that ends at the
|
||||
@@ -2084,7 +2090,7 @@ function compileConnectors(model, lanes, diagnostics, overrides, junctionPlans)
|
||||
const length = lineLengthMeters(coordinates);
|
||||
const id = `movement:${connection.id}:${defaultFromLane.id}->${defaultToLane.id}`;
|
||||
const provenance = override ? `override:${override.id}` : connection.provenance;
|
||||
const connectorId = `connector:${id}`;
|
||||
const connectorId = `${connectionConnectorId(connection.id)}:${defaultFromLane.id}->${defaultToLane.id}`;
|
||||
const geometryStatus = length < 0.4 ? 'continuous' : length > 80 ? 'deferred-too-long' : 'connector';
|
||||
const movement = {
|
||||
id,
|
||||
@@ -2355,7 +2361,7 @@ function compileJunctionSurfaces(model, junctionPlans, connectors, movements, di
|
||||
result.push({
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
native_id: `junction:node/${nodeId}`,
|
||||
native_id: junctionSurfaceId(nodeId),
|
||||
osm_node_id: nodeId,
|
||||
kind: segmentIds.size === 3 ? 't' : 'cross',
|
||||
source_road_ids: approaches.flatMap((approach) => approach.roadIds).join(','),
|
||||
|
||||
Reference in new issue
Block a user