{"record":{"id":"8217688c45239612","repo":"a-b-street/abstreet","slug":"doesn-t-have-a-column-called-longitude-latitude-or-geometry","errorCode":null,"errorMessage":"{} doesn't have a column called Longitude, Latitude, or geometry","messagePattern":"(.+?) doesn't have a column called Longitude, Latitude, or geometry","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kml/src/lib.rs","lineNumber":185,"sourceCode":"                                points: vec![pt],\n                                attributes: rec,\n                            });\n                        }\n                    }\n                }\n                (None, None, Some(raw)) => {\n                    if let Some(points) = LonLat::parse_wkt_linestring(&raw) {\n                        if gps_bounds.try_convert(&points).is_some() {\n                            shapes.push(ExtraShape {\n                                points,\n                                attributes: rec,\n                            });\n                        }\n                    }\n                }\n                _ => {\n                    timer.stop(format!(\"read {}\", path));\n                    bail!(\n                        \"{} doesn't have a column called Longitude, Latitude, or geometry\",\n                        path\n                    )\n                }\n            }\n        }\n        timer.stop(format!(\"read {}\", path));\n        Ok(ExtraShapes { shapes })\n    }\n}\n\nimpl ExtraShapes {\n    /// Parses a .geojson file and returns ExtraShapes\n    pub fn load_geojson_no_clipping(\n        path: String,\n        gps_bounds: &GPSBounds,\n        require_in_bounds: bool,\n    ) -> Result<ExtraShapes> {","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/kml/src/lib.rs#L167-L203","documentation":"load_csv reads a CSV of point data and supports either Longitude+Latitude columns or a WKT 'geometry' column. If after scanning headers none of these columns exist, it stops the timer and bails naming the file — the CSV's schema is incompatible with the loader.","triggerScenarios":"Calling load_csv on a CSV using different column names ('lon'/'lat', 'x'/'y', 'LONG'/'LAT') or a file with no location columns at all.","commonSituations":"Sensor/detector data exports from agencies with nonstandard headers; CSVs that store coordinates as a single 'latlon' string column; accidentally passing a metadata-only CSV.","solutions":["Rename the CSV headers to exactly 'Longitude' and 'Latitude' (or add a WKT 'geometry' column with POINT(...)).","Preprocess with a script (awk/python/jq) to emit the expected columns.","Check you're passing the right file — one that actually contains locations."],"exampleFix":"// before\nlon,lat,value\n// after\nLongitude,Latitude,value","handlingStrategy":"validation","validationCode":"let headers = csv::Reader::from_path(path)?.headers()?.clone();\nlet has = headers.iter().any(|h| h == \"Longitude\" || h == \"Latitude\")\n       || headers.iter().any(|h| h == \"geometry\");\nif !has { bail!(\"{} lacks Longitude/Latitude/geometry columns\", path); }","typeGuard":null,"tryCatchPattern":"match load_csv(path, timer) {\n    Ok(rows) => rows,\n    Err(e) if e.to_string().contains(\"doesn't have a column called Longitude\") => {\n        eprintln!(\"Rename lon/lat headers to Longitude/Latitude: {e}\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Standardize CSV exports on Longitude/Latitude or WKT geometry headers","Inspect headers (head -1 file.csv) before loading","Add a small preprocessing step that renames common aliases (lon/lat/x/y)"],"tags":["csv","schema","importer"],"backgroundTag":"schema-validation-failed","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"}