skip csv lines with no geometry as is done for geojson

This commit is contained in:
Andrew Harvey 2018-04-06 10:56:51 +10:00
parent 6b29966e4a
commit 970af8109e

View File

@ -61,10 +61,18 @@ void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fnam
std::vector<std::string> line = csv_split(s.c_str());
if (line.size() != header.size()) {
fprintf(stderr, "%s:%zu: Mismatched column count: %zu in line, %zu in header\n", fname.c_str(), seq, line.size(), header.size());
fprintf(stderr, "%s:%zu: Mismatched column count: %zu in line, %zu in header\n", fname.c_str(), seq + 1, line.size(), header.size());
exit(EXIT_FAILURE);
}
if (line[loncol].empty() || line[latcol].empty()) {
static int warned = 0;
if (!warned) {
fprintf(stderr, "%s:%zu: null geometry (additional not reported)\n", fname.c_str(), seq + 1);
warned = 1;
}
continue;
}
double lon = atof(line[loncol].c_str());
double lat = atof(line[latcol].c_str());