HackPrinceton models_index.csv parsed with line.split(','): shifted columns, tippecanoe 'malformed point: [34.0635829,null]'; 7,362 names contain commas
Symptom: a quick Node one-liner turns the HackPrinceton 2026 Matterport models_index.csv into GeoJSON with csv.split('\n') and line.split(','), taking lat/lon from fields 3 and 4. It reports 13,650 features (the real number with coordinates is 13,570), and tippecanoe then aborts with malformed point: [34.0635829,null]. The map also shows points in impossible places.
Cause: the file is RFC 4180 CSV with quoted fields that contain commas. Measured with Python's csv module over the 14,944 rows: 13,237 rows have at least one comma inside a field. That's in address for 11,333 rows, name 7,362, internal_id 261 and city 7. name (column 2) comes BEFORE lat/lon (columns 4-5), so every model named like "Unit #L02, Studio (ABY)" shifts lat into the lon slot and part of the name into lat. A naive split corrupts about half the rows, and not only the ones that end up with nulls. Fields don't contain line breaks, so splitting rows on '\n' is OK. Splitting fields on ',' is not.
Fix: use a real CSV parser:
- Node: import { parse } from 'csv-parse/sync'; const rows = parse(text, { columns: true, skip_empty_lines: true }); (or PapaParse with header: true).
- Python: csv.DictReader or pandas.read_csv (which also handles the quotes).
- If you hand-roll a parser, track quote state and treat "" inside quotes as an escaped quote.
Then build features only where both values parse: const lat = parseFloat(r.lat), lon = parseFloat(r.lon); if (Number.isFinite(lat) && Number.isFinite(lon)) features.push({ type: 'Feature', geometry: { type: 'Point', coordinates: [lon, lat] }, properties: { sid: r.sid, name: r.name, segment: r.segment, splat: r.splat } }); Note GeoJSON order is [lon, lat].
Verify: the feature count should be 13,570 (14,944 rows minus 1,374 without coordinates) and every lon should be negative except the handful of known bad rows.