Commit a981624f authored by Bas Couwenberg's avatar Bas Couwenberg

Merge tag 'upstream/2.2.4'

Upstream version 2.2.4
parents 649f6f27 042d0cc0
build
*.swp *.swp
.ycm_extra_conf.pyc .ycm_extra_conf.pyc
...@@ -13,7 +13,19 @@ This project adheres to [Semantic Versioning](https://semver.org/). ...@@ -13,7 +13,19 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Fixed ### Fixed
## [2.2.3] - 2018-02-06 ## [2.2.4] - 2019-02-27
### Changed
- Also look for newer clang-tidy versions in CMake config.
### Fixed
- Put Antarctic closure to exactly +/- 180 degree longitude.
- Add try/catch around most of main so we don't end with exception.
## [2.2.3] - 2019-02-06
### Fixed ### Fixed
...@@ -21,7 +33,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ...@@ -21,7 +33,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Better error reporting on some exceptions. - Better error reporting on some exceptions.
## [2.2.2] - 2018-02-03 ## [2.2.2] - 2019-02-03
### Fixed ### Fixed
...@@ -148,7 +160,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). ...@@ -148,7 +160,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Added man pages - Added man pages
[unreleased]: https://github.com/osmcode/osmium-tool/compare/v2.2.3...HEAD [unreleased]: https://github.com/osmcode/osmium-tool/compare/v2.2.4...HEAD
[2.2.4]: https://github.com/osmcode/osmium-tool/compare/v2.2.3...v2.2.4
[2.2.3]: https://github.com/osmcode/osmium-tool/compare/v2.2.2...v2.2.3 [2.2.3]: https://github.com/osmcode/osmium-tool/compare/v2.2.2...v2.2.3
[2.2.2]: https://github.com/osmcode/osmium-tool/compare/v2.2.1...v2.2.2 [2.2.2]: https://github.com/osmcode/osmium-tool/compare/v2.2.1...v2.2.2
[2.2.1]: https://github.com/osmcode/osmium-tool/compare/v2.2.0...v2.2.1 [2.2.1]: https://github.com/osmcode/osmium-tool/compare/v2.2.0...v2.2.1
......
...@@ -20,7 +20,7 @@ project(osmcoastline) ...@@ -20,7 +20,7 @@ project(osmcoastline)
set(OSMCOASTLINE_VERSION_MAJOR 2) set(OSMCOASTLINE_VERSION_MAJOR 2)
set(OSMCOASTLINE_VERSION_MINOR 2) set(OSMCOASTLINE_VERSION_MINOR 2)
set(OSMCOASTLINE_VERSION_PATCH 3) set(OSMCOASTLINE_VERSION_PATCH 4)
set(OSMCOASTLINE_VERSION set(OSMCOASTLINE_VERSION
${OSMCOASTLINE_VERSION_MAJOR}.${OSMCOASTLINE_VERSION_MINOR}.${OSMCOASTLINE_VERSION_PATCH}) ${OSMCOASTLINE_VERSION_MAJOR}.${OSMCOASTLINE_VERSION_MINOR}.${OSMCOASTLINE_VERSION_PATCH})
...@@ -138,7 +138,7 @@ set(CMAKE_BUILD_TYPE ${build_type} ...@@ -138,7 +138,7 @@ set(CMAKE_BUILD_TYPE ${build_type}
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
message(STATUS "Looking for clang-tidy") message(STATUS "Looking for clang-tidy")
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-6.0 clang-tidy-5.0) find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-7 clang-tidy-7.0 clang-tidy-6.0 clang-tidy-5.0)
if(CLANG_TIDY) if(CLANG_TIDY)
message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}") message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}")
......
...@@ -98,7 +98,7 @@ void CoastlineRing::close_antarctica_ring(int epsg) { ...@@ -98,7 +98,7 @@ void CoastlineRing::close_antarctica_ring(int epsg) {
const double min = epsg == 4326 ? -90.0 : -85.0511288; const double min = epsg == 4326 ? -90.0 : -85.0511288;
for (int lat = -78; lat > int(min); --lat) { for (int lat = -78; lat > int(min); --lat) {
m_way_node_list.emplace_back(0, osmium::Location{-179.99999, double(lat)}); m_way_node_list.emplace_back(0, osmium::Location{-180.0, double(lat)});
} }
for (int lon = -180; lon < 180; ++lon) { for (int lon = -180; lon < 180; ++lon) {
...@@ -106,11 +106,11 @@ void CoastlineRing::close_antarctica_ring(int epsg) { ...@@ -106,11 +106,11 @@ void CoastlineRing::close_antarctica_ring(int epsg) {
} }
if (epsg == 3857) { if (epsg == 3857) {
m_way_node_list.emplace_back(0, osmium::Location{179.99999, min}); m_way_node_list.emplace_back(0, osmium::Location{180.0, min});
} }
for (auto lat = static_cast<int>(min); lat < -78; ++lat) { for (auto lat = static_cast<int>(min); lat < -78; ++lat) {
m_way_node_list.emplace_back(0, osmium::Location{179.99999, double(lat)}); m_way_node_list.emplace_back(0, osmium::Location{180.0, double(lat)});
} }
m_way_node_list.push_back(m_way_node_list.front()); m_way_node_list.push_back(m_way_node_list.front());
......
...@@ -96,11 +96,6 @@ int main(int argc, char* argv[]) { ...@@ -96,11 +96,6 @@ int main(int argc, char* argv[]) {
} }
} }
// The vout object is an output stream we can write to instead of
// std::cerr. Nothing is written if we are not in verbose mode.
// The running time will be prepended to output lines.
osmium::util::VerboseOutput vout{verbose};
if (output_filename.empty()) { if (output_filename.empty()) {
std::cerr << "Missing -o/--output=OSMFILE option\n"; std::cerr << "Missing -o/--output=OSMFILE option\n";
std::exit(return_code_cmdline); std::exit(return_code_cmdline);
...@@ -111,15 +106,20 @@ int main(int argc, char* argv[]) { ...@@ -111,15 +106,20 @@ int main(int argc, char* argv[]) {
std::exit(return_code_cmdline); std::exit(return_code_cmdline);
} }
osmium::io::Header header; try {
header.set("generator", std::string{"osmcoastline_filter/"} + get_osmcoastline_version()); // The vout object is an output stream we can write to instead of
header.add_box(osmium::Box{-180.0, -90.0, 180.0, 90.0}); // std::cerr. Nothing is written if we are not in verbose mode.
// The running time will be prepended to output lines.
osmium::util::VerboseOutput vout{verbose};
osmium::io::Header header;
header.set("generator", std::string{"osmcoastline_filter/"} + get_osmcoastline_version());
header.add_box(osmium::Box{-180.0, -90.0, 180.0, 90.0});
osmium::io::File infile{argv[optind]}; osmium::io::File infile{argv[optind]};
vout << "Started osmcoastline_filter " << get_osmcoastline_long_version() << " / " << get_libosmium_version() << '\n'; vout << "Started osmcoastline_filter " << get_osmcoastline_long_version() << " / " << get_libosmium_version() << '\n';
try {
osmium::io::Writer writer{output_filename, header}; osmium::io::Writer writer{output_filename, header};
auto output_it = osmium::io::make_output_iterator(writer); auto output_it = osmium::io::make_output_iterator(writer);
...@@ -169,16 +169,16 @@ int main(int argc, char* argv[]) { ...@@ -169,16 +169,16 @@ int main(int argc, char* argv[]) {
} }
writer.close(); writer.close();
} catch (const osmium::io_error& e) {
std::cerr << "io error: " << e.what() << "'\n";
std::exit(return_code_fatal);
}
vout << "All done.\n"; vout << "All done.\n";
osmium::MemoryUsage mem; osmium::MemoryUsage mem;
if (mem.current() > 0) { if (mem.current() > 0) {
vout << "Memory used: current: " << mem.current() << " MBytes\n" vout << "Memory used: current: " << mem.current() << " MBytes\n"
<< " peak: " << mem.peak() << " MBytes\n"; << " peak: " << mem.peak() << " MBytes\n";
}
} catch (const std::exception& e) {
std::cerr << e.what() << '\n';
std::exit(return_code_fatal);
} }
} }
...@@ -162,10 +162,10 @@ int main(int argc, char *argv[]) { ...@@ -162,10 +162,10 @@ int main(int argc, char *argv[]) {
std::exit(return_code_cmdline); std::exit(return_code_cmdline);
} }
segvec removed_segments;
segvec added_segments;
try { try {
segvec removed_segments;
segvec added_segments;
InputFile file1{argv[optind]}; InputFile file1{argv[optind]};
InputFile file2{argv[optind + 1]}; InputFile file2{argv[optind + 1]};
...@@ -174,25 +174,25 @@ int main(int argc, char *argv[]) { ...@@ -174,25 +174,25 @@ int main(int argc, char *argv[]) {
std::set_difference(m1.cbegin(), m1.cend(), m2.cbegin(), m2.cend(), std::back_inserter(removed_segments)); std::set_difference(m1.cbegin(), m1.cend(), m2.cbegin(), m2.cend(), std::back_inserter(removed_segments));
std::set_difference(m2.cbegin(), m2.cend(), m1.cbegin(), m1.cend(), std::back_inserter(added_segments)); std::set_difference(m2.cbegin(), m2.cend(), m1.cbegin(), m1.cend(), std::back_inserter(added_segments));
} catch (const std::runtime_error& e) {
std::cerr << e.what() << "\n";
std::exit(return_code_fatal);
}
if (dump) { if (dump) {
std::cout << "Removed:\n"; std::cout << "Removed:\n";
for (const auto& segment : removed_segments) { for (const auto& segment : removed_segments) {
std::cout << " " << segment << "\n"; std::cout << " " << segment << "\n";
} }
std::cout << "Added:\n"; std::cout << "Added:\n";
for (const auto& segment : added_segments) { for (const auto& segment : added_segments) {
std::cout << " " << segment << "\n"; std::cout << " " << segment << "\n";
}
} else if (!geom.empty()) {
output_ogr(geom, format, removed_segments, added_segments);
} }
} else if (!geom.empty()) {
output_ogr(geom, format, removed_segments, added_segments);
}
return (removed_segments.empty() && added_segments.empty()) ? 0 : 1; return (removed_segments.empty() && added_segments.empty()) ? 0 : 1;
} catch (const std::exception& e) {
std::cerr << e.what() << '\n';
std::exit(return_code_fatal);
}
} }
...@@ -129,27 +129,32 @@ int main(int argc, char* argv[]) { ...@@ -129,27 +129,32 @@ int main(int argc, char* argv[]) {
CPLSetConfigOption("OGR_SQLITE_SYNCHRONOUS", "OFF"); CPLSetConfigOption("OGR_SQLITE_SYNCHRONOUS", "OFF");
const std::string input_osm_filename{argv[1]}; try {
const std::string input_osm_filename{argv[1]};
std::string output_db_filename{"coastline-ways.db"}; std::string output_db_filename{"coastline-ways.db"};
if (argc >= 3) { if (argc >= 3) {
output_db_filename = argv[2]; output_db_filename = argv[2];
} }
index_type index_pos; index_type index_pos;
index_type index_neg; index_type index_neg;
location_handler_type location_handler{index_pos, index_neg}; location_handler_type location_handler{index_pos, index_neg};
osmium::io::File infile{input_osm_filename}; osmium::io::File infile{input_osm_filename};
osmium::io::Reader reader1{infile, osmium::osm_entity_bits::node}; osmium::io::Reader reader1{infile, osmium::osm_entity_bits::node};
osmium::apply(reader1, location_handler); osmium::apply(reader1, location_handler);
reader1.close(); reader1.close();
CoastlineWaysHandler coastline_ways_handler{output_db_filename}; CoastlineWaysHandler coastline_ways_handler{output_db_filename};
osmium::io::Reader reader2{infile, osmium::osm_entity_bits::way}; osmium::io::Reader reader2{infile, osmium::osm_entity_bits::way};
osmium::apply(reader2, location_handler, coastline_ways_handler); osmium::apply(reader2, location_handler, coastline_ways_handler);
reader2.close(); reader2.close();
std::cerr << "Sum of way lengths: " << std::fixed << (coastline_ways_handler.sum_length() / 1000) << "km\n"; std::cerr << "Sum of way lengths: " << std::fixed << (coastline_ways_handler.sum_length() / 1000) << "km\n";
} catch (const std::exception& e) {
std::cerr << e.what() << '\n';
std::exit(return_code_fatal);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment