{"record":{"id":"e0c50f289b451baa","repo":"a-b-street/abstreet","slug":"front-path-has-0-length","errorCode":null,"errorMessage":"front path has 0 length","messagePattern":"front path has 0 length","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"map_model/src/make/parking_lots.rs","lineNumber":147,"sourceCode":"    results\n}\n\n/// Returns (driveway_line, driving_pos, sidewalk_line, sidewalk_pos)\npub fn snap_driveway(\n    center: HashablePt2D,\n    polygon: &Polygon,\n    sidewalk_pts: &HashMap<HashablePt2D, Position>,\n    map: &Map,\n) -> Result<(PolyLine, Position, Line, Position)> {\n    let driveway_buffer = Distance::meters(7.0);\n\n    let sidewalk_pos = sidewalk_pts\n        .get(&center)\n        .ok_or_else(|| anyhow!(\"parking lot center didn't snap to a sidewalk\"))?;\n    let sidewalk_line = match Line::new(center.to_pt2d(), sidewalk_pos.pt(map)) {\n        Ok(l) => trim_path(polygon, l),\n        Err(_) => {\n            bail!(\"front path has 0 length\");\n        }\n    };\n\n    // Can this lot have a driveway? If it's not next to a driving lane, then no.\n    let mut driveway: Option<(PolyLine, Position)> = None;\n    let sidewalk_lane = sidewalk_pos.lane();\n    if let Some(driving_pos) = map\n        .get_parent(sidewalk_lane)\n        .find_closest_lane(sidewalk_lane, |l| PathConstraints::Car.can_use(l, map))\n        .and_then(|l| {\n            sidewalk_pos\n                .equiv_pos(l, map)\n                .buffer_dist(driveway_buffer, map)\n        })\n    {\n        if let Ok(pl) = PolyLine::new(vec![\n            sidewalk_line.pt1(),\n            sidewalk_line.pt2(),","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/map_model/src/make/parking_lots.rs#L129-L165","documentation":"When snapping a parking lot driveway, the library draws a line from the lot's center to the nearest sidewalk point and trims it against the lot's polygon. If Line::new fails, the center is effectively on the sidewalk (zero-length front path), so no driveway geometry can be built and the lot is skipped.","triggerScenarios":"fix_parking_lot_driveways / make_all_parking_lots calling snap_driveway where the parking lot polygon extends all the way to the snapped sidewalk point, making center-to-sidewalk distance ~0 and Line::new reject a degenerate line.","commonSituations":"Importing OSM parking lot polygons that touch or overlap the sidewalk; small/oddly-shaped lots whose centroid lies near the sidewalk; maps generated in dense urban areas with lots abutting sidewalks.","solutions":["Skip the lot (the caller does this) or fix the OSM polygon so the lot doesn't reach the sidewalk.","Adjust the snapped sidewalk point threshold in map generation so the center-to-sidewalk line has positive length.","Edit the parking lot polygon in the input data to pull its boundary back from the sidewalk."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"let d = center.to_pt2d().distance(sidewalk_pos.pt(map));\nif d <= Distance::ZERO || trim_path(polygon, line).is_err() { skip_lot = true; }","typeGuard":null,"tryCatchPattern":"match snap_driveway(&lot, ...) {\n    Ok(driveway) => ..., \n    Err(e) if e.to_string().contains(\"front path has 0 length\") => {\n        warn!(\"skipping lot {:?}: no driveway possible\", lot.id);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Sanity-check OSM parking lot polygons for overlap with sidewalks before import","Treat per-lot driveway failures as skippable warnings in import tooling","Review degenerate/small polygons flagged during map generation"],"tags":["map-import","parking-lots","geometry"],"backgroundTag":"invalid-argument-value","analyzedSha":"0964f29315820c91b171b585eb51e300164e9197","analyzedAt":"2026-09-13T18:02:03.421Z","contentChangedAt":"2026-09-13T18:02:03.421Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}