a-b-street/abstreet · error

doesn't have a column called Longitude, Latitude, or…

Error message

{} doesn't have a column called Longitude, Latitude, or geometry

What it means

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.

Solutions

  1. Rename the CSV headers to exactly 'Longitude' and 'Latitude' (or add a WKT 'geometry' column with POINT(...)).
  2. Preprocess with a script (awk/python/jq) to emit the expected columns.
  3. Check you're passing the right file — one that actually contains locations.

Example fix

// before
lon,lat,value
// after
Longitude,Latitude,value
Defensive patterns

Strategy: validation

Validate before calling

let headers = csv::Reader::from_path(path)?.headers()?.clone();
let has = headers.iter().any(|h| h == "Longitude" || h == "Latitude")
       || headers.iter().any(|h| h == "geometry");
if !has { bail!("{} lacks Longitude/Latitude/geometry columns", path); }

Try / catch

match load_csv(path, timer) {
    Ok(rows) => rows,
    Err(e) if e.to_string().contains("doesn't have a column called Longitude") => {
        eprintln!("Rename lon/lat headers to Longitude/Latitude: {e}");
        return Err(e);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of a-b-street/abstreet@0964f29315 (2026-09-13). Data as JSON: /api/errors/8217688c45239612. Report an issue: GitHub.

Appendix: source

Thrown at kml/src/lib.rs:185

                                points: vec![pt],
                                attributes: rec,
                            });
                        }
                    }
                }
                (None, None, Some(raw)) => {
                    if let Some(points) = LonLat::parse_wkt_linestring(&raw) {
                        if gps_bounds.try_convert(&points).is_some() {
                            shapes.push(ExtraShape {
                                points,
                                attributes: rec,
                            });
                        }
                    }
                }
                _ => {
                    timer.stop(format!("read {}", path));
                    bail!(
                        "{} doesn't have a column called Longitude, Latitude, or geometry",
                        path
                    )
                }
            }
        }
        timer.stop(format!("read {}", path));
        Ok(ExtraShapes { shapes })
    }
}

impl ExtraShapes {
    /// Parses a .geojson file and returns ExtraShapes
    pub fn load_geojson_no_clipping(
        path: String,
        gps_bounds: &GPSBounds,
        require_in_bounds: bool,
    ) -> Result<ExtraShapes> {

View on GitHub (pinned to 0964f29315)