Fix check for non-numeric CSV data. Use same column name code as mapnik

This commit is contained in:
Eric Fischer 2017-12-07 11:28:39 -08:00
parent ec475b3beb
commit ed0b69a3c8
2 changed files with 11 additions and 3 deletions

View File

@ -157,7 +157,12 @@ bool is_number(std::string const &s) {
}
}
return true;
if (*cp == '\0') {
return true;
} else {
// Something non-numeric at the end
return false;
}
}
return false;

View File

@ -31,10 +31,13 @@ void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fnam
for (size_t i = 0; i < header.size(); i++) {
header[i] = csv_dequote(header[i]);
if (header[i] == "lat" || header[i] == "latitude") {
std::string lower(header[i]);
std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
if (lower == "y" || lower == "lat" || (lower.find("latitude") != std::string::npos)) {
latcol = i;
}
if (header[i] == "lon" || header[i] == "longitude" || header[i] == "long") {
if (lower == "x" || lower == "lon" || lower == "lng" || lower == "long" || (lower.find("longitude") != std::string::npos)) {
loncol = i;
}
}