csv2geojson icon indicating copy to clipboard operation
csv2geojson copied to clipboard

Error or null geometry when lng,lat not detected?

Open davidtheclark opened this issue 9 years ago • 5 comments

In previous versions, this module threw an error when lng,lat were not detected. The documentation suggests this still should happen:

Err is non-falsy if latitude and longitude values cannot be detected or if there are invalid rows in the file.

However, I think commit https://github.com/mapbox/csv2geojson/commit/ee8d854540c5733bbc79c1f7678228988b850dc5 changed this behavior. The module now returns a null geometry. However, that commit did not update the documentation, and it left the relevant test in a strange place, where its description no longer matches its outcome.

So @tmcw I'm wondering which route you think would be best for this module. Should we document and clearly test the actual current behavior — not erroring, instead returning null geometry — or go back to the way things were — erroring?

davidtheclark avatar Sep 30 '16 00:09 davidtheclark

I preferred the error behavior, because it gave clear feedback to the user. null seems like silent failure, the worst kind. But apparently lots of people have CSVs with some but not all geodata, so maybe silent failure is what the people want.

tmcw avatar Mar 20 '17 19:03 tmcw

I like the error better, too.

davidtheclark avatar Mar 20 '17 19:03 davidtheclark

I prefer a warning. AS @tmcw points out lots of people have CSVs with some but not all geodata. This is all perfectly valid so I don't think csv2geojson shouldn't have an opinion about it, it should just pass it through.

If you error how would you use this tool to convert csv2geojson where some records have no geometry?

andrewharvey avatar Apr 13 '18 22:04 andrewharvey

This is an old issue, but it seems that records with no geometry still get skipped. Is this to remain the behavior then?

Jmuccigr avatar Oct 20 '21 18:10 Jmuccigr

Coming back to this again. It seems like the geojson spec 3.2 allows for null geometries when an object is unlocated, so empty lat and lon would seem then to call for that, no? I don't mind if an error is thrown as well, so long as those objects get included in the output geojson.

Jmuccigr avatar Mar 17 '22 15:03 Jmuccigr