mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-01 08:47:57 +00:00
Fix check for non-numeric CSV data. Use same column name code as mapnik
This commit is contained in:
parent
ec475b3beb
commit
ed0b69a3c8
7
csv.cpp
7
csv.cpp
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user