Skip to content

Commit f8af84c

Browse files
committed
import: handle postcodes without coordinates
1 parent c6200bc commit f8af84c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

importer/src/main.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,15 @@ int main(int argc, char* argv[])
970970
if (cells.size() != 4 || cells[0] == "id")
971971
continue;
972972
std::string code = cells[1];
973-
double latitude = std::stod(cells[2]);
974-
double longitude = std::stod(cells[3]);
973+
double latitude, longitude;
974+
try {
975+
latitude = std::stod(cells[2]);
976+
longitude = std::stod(cells[3]);
977+
}
978+
catch (const std::invalid_argument &e) {
979+
continue; // skip this line, it probably doesn't have coordinates
980+
}
981+
975982
osmscout::GeoCoord coordinates(latitude, longitude);
976983
std::list<osmscout::LocationDescriptionService::ReverseLookupResult> results;
977984
{

0 commit comments

Comments
 (0)