mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Fix check for non-numeric CSV data. Use same column name code as mapnik
This commit is contained in:
@@ -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;
|
return false;
|
||||||
|
|||||||
+5
-2
@@ -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++) {
|
for (size_t i = 0; i < header.size(); i++) {
|
||||||
header[i] = csv_dequote(header[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;
|
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;
|
loncol = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user