Bump osmium to version 2.20.0 (#6997)
This commit is contained in:
committed by
GitHub
parent
676f6d4704
commit
09a716a9e5
+2
-2
@@ -74,8 +74,8 @@ class AmenityHandler : public osmium::handler::Handler {
|
||||
c.y += nr.lat();
|
||||
}
|
||||
|
||||
c.x /= nr_list.size();
|
||||
c.y /= nr_list.size();
|
||||
c.x /= static_cast<double>(nr_list.size());
|
||||
c.y /= static_cast<double>(nr_list.size());
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
+2
-2
@@ -122,11 +122,11 @@ int main(int argc, char* argv[]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
osmium::io::File input_file{argv[2]};
|
||||
const osmium::io::File input_file{argv[2]};
|
||||
|
||||
// Configuration for the multipolygon assembler. Here the default settings
|
||||
// are used, but you could change multiple settings.
|
||||
osmium::area::Assembler::config_type assembler_config;
|
||||
const osmium::area::Assembler::config_type assembler_config;
|
||||
|
||||
// Set up a filter matching only forests. This will be used to only build
|
||||
// areas with matching tags.
|
||||
|
||||
+2
-2
@@ -153,8 +153,8 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
// Get input and output file names from command line.
|
||||
std::string input_file_name{argv[1]};
|
||||
std::string output_file_name{argv[2]};
|
||||
const std::string input_file_name{argv[1]};
|
||||
const std::string output_file_name{argv[2]};
|
||||
|
||||
try {
|
||||
// Initialize Reader
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ int main(int argc, char* argv[]) {
|
||||
try {
|
||||
// The Reader is initialized here with an osmium::io::File, but could
|
||||
// also be directly initialized with a file name.
|
||||
osmium::io::File input_file{argv[1]};
|
||||
const osmium::io::File input_file{argv[1]};
|
||||
osmium::io::Reader reader{input_file};
|
||||
|
||||
// Create an instance of our own CountHandler and push the data from the
|
||||
@@ -88,7 +88,7 @@ int main(int argc, char* argv[]) {
|
||||
// (though not this one) can use huge amounts of data. So checking actual
|
||||
// memore usage is often useful and can be done easily with this class.
|
||||
// (Currently only works on Linux, not macOS and Windows.)
|
||||
osmium::MemoryUsage memory;
|
||||
const osmium::MemoryUsage memory;
|
||||
|
||||
std::cout << "\nMemory used: " << memory.peak() << " MBytes\n";
|
||||
} catch (const std::exception& e) {
|
||||
|
||||
+2
-2
@@ -40,11 +40,11 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
// Get output file name from command line.
|
||||
std::string output_file_name{argv[1]};
|
||||
const std::string output_file_name{argv[1]};
|
||||
|
||||
// If output file name is "-", this means STDOUT. Set the OPL file type
|
||||
// in this case. Otherwise take the file type from the file name suffix.
|
||||
osmium::io::File output_file{output_file_name, output_file_name == "-" ? ".opl" : ""};
|
||||
const osmium::io::File output_file{output_file_name, output_file_name == "-" ? ".opl" : ""};
|
||||
|
||||
try {
|
||||
// Create a buffer where all objects will live. Use a sensible initial
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ int main(int argc, char* argv[]) {
|
||||
// Get entity types from command line if there is a 2nd argument.
|
||||
if (argc == 3) {
|
||||
read_types = osmium::osm_entity_bits::nothing;
|
||||
std::string types = argv[2];
|
||||
const std::string types = argv[2];
|
||||
if (types.find('n') != std::string::npos) {
|
||||
read_types |= osmium::osm_entity_bits::node;
|
||||
}
|
||||
|
||||
+7
-7
@@ -165,31 +165,31 @@ int main(int argc, char* argv[]) {
|
||||
reader.close();
|
||||
|
||||
// Write out node, way, and relation offset indexes to disk.
|
||||
IndexFile nodes_idx{output_dir + "/nodes.idx"};
|
||||
const IndexFile nodes_idx{output_dir + "/nodes.idx"};
|
||||
node_index.dump_as_list(nodes_idx.fd());
|
||||
|
||||
IndexFile ways_idx{output_dir + "/ways.idx"};
|
||||
const IndexFile ways_idx{output_dir + "/ways.idx"};
|
||||
way_index.dump_as_list(ways_idx.fd());
|
||||
|
||||
IndexFile relations_idx{output_dir + "/relations.idx"};
|
||||
const IndexFile relations_idx{output_dir + "/relations.idx"};
|
||||
relation_index.dump_as_list(relations_idx.fd());
|
||||
|
||||
// Sort the maps (so later binary search will work on them) and write
|
||||
// them to disk.
|
||||
map_node2way.sort();
|
||||
IndexFile node2way_idx{output_dir + "/node2way.map"};
|
||||
const IndexFile node2way_idx{output_dir + "/node2way.map"};
|
||||
map_node2way.dump_as_list(node2way_idx.fd());
|
||||
|
||||
map_node2relation.sort();
|
||||
IndexFile node2relation_idx{output_dir + "/node2rel.map"};
|
||||
const IndexFile node2relation_idx{output_dir + "/node2rel.map"};
|
||||
map_node2relation.dump_as_list(node2relation_idx.fd());
|
||||
|
||||
map_way2relation.sort();
|
||||
IndexFile way2relation_idx{output_dir + "/way2rel.map"};
|
||||
const IndexFile way2relation_idx{output_dir + "/way2rel.map"};
|
||||
map_way2relation.dump_as_list(way2relation_idx.fd());
|
||||
|
||||
map_relation2relation.sort();
|
||||
IndexFile relation2relation_idx{output_dir + "/rel2rel.map"};
|
||||
const IndexFile relation2relation_idx{output_dir + "/rel2rel.map"};
|
||||
map_relation2relation.dump_as_list(relation2relation_idx.fd());
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
|
||||
@@ -47,10 +47,10 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
try {
|
||||
// The input file, deduce file format from file suffix.
|
||||
osmium::io::File input_file{argv[1]};
|
||||
const osmium::io::File input_file{argv[1]};
|
||||
|
||||
// The output file, force XML OSM file format.
|
||||
osmium::io::File output_file{argv[2], "osm"};
|
||||
const osmium::io::File output_file{argv[2], "osm"};
|
||||
|
||||
// Initialize Reader for the input file.
|
||||
// Read only changesets (will ignore nodes, ways, and
|
||||
|
||||
+7
-7
@@ -67,8 +67,8 @@ public:
|
||||
IndexAccess(const IndexAccess&) = delete;
|
||||
IndexAccess& operator=(const IndexAccess&) = delete;
|
||||
|
||||
IndexAccess(IndexAccess&&) = delete;
|
||||
IndexAccess& operator=(IndexAccess&&) = delete;
|
||||
IndexAccess(IndexAccess&&) noexcept = delete;
|
||||
IndexAccess& operator=(IndexAccess&&) noexcept = delete;
|
||||
|
||||
virtual ~IndexAccess() noexcept = default;
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
~IndexAccessDense() noexcept override = default;
|
||||
|
||||
void dump() const override {
|
||||
index_type index{this->fd()};
|
||||
const index_type index{this->fd()};
|
||||
|
||||
for (std::size_t i = 0; i < index.size(); ++i) {
|
||||
if (index.get(i) != TValue{}) {
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
}
|
||||
|
||||
bool search(const osmium::unsigned_object_id_type& key) const override {
|
||||
index_type index{this->fd()};
|
||||
const index_type index{this->fd()};
|
||||
|
||||
try {
|
||||
TValue value = index.get(key);
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
~IndexAccessSparse() noexcept override = default;
|
||||
|
||||
void dump() const override {
|
||||
index_type index{this->fd()};
|
||||
const index_type index{this->fd()};
|
||||
|
||||
for (const auto& element : index) {
|
||||
std::cout << element.first << " " << element.second << "\n";
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
using element_type = typename index_type::element_type;
|
||||
index_type index{this->fd()};
|
||||
|
||||
element_type elem{key, TValue{}};
|
||||
const element_type elem{key, TValue{}};
|
||||
const auto positions = std::equal_range(index.begin(),
|
||||
index.end(),
|
||||
elem,
|
||||
@@ -347,7 +347,7 @@ int run(const IndexAccess<TValue>& index, const Options& options) {
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// Parse command line options.
|
||||
Options options{argc, argv};
|
||||
const Options options{argc, argv};
|
||||
|
||||
// Open the index file.
|
||||
const int fd = ::open(options.filename(), O_RDWR);
|
||||
|
||||
+2
-2
@@ -27,11 +27,11 @@ int main(int argc, char* argv[]) {
|
||||
try {
|
||||
// The Reader is initialized here with an osmium::io::File, but could
|
||||
// also be directly initialized with a file name.
|
||||
osmium::io::File input_file{argv[1]};
|
||||
const osmium::io::File input_file{argv[1]};
|
||||
osmium::io::Reader reader{input_file};
|
||||
|
||||
// OSM data comes in buffers, read until there are no more.
|
||||
while (osmium::memory::Buffer buffer = reader.read()) {
|
||||
while (const osmium::memory::Buffer buffer = reader.read()) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
@@ -34,14 +34,14 @@ int main(int argc, char* argv[]) {
|
||||
try {
|
||||
// The Reader is initialized here with an osmium::io::File, but could
|
||||
// also be directly initialized with a file name.
|
||||
osmium::io::File input_file{argv[1]};
|
||||
const osmium::io::File input_file{argv[1]};
|
||||
osmium::io::Reader reader{input_file};
|
||||
|
||||
// Initialize progress bar, enable it only if STDERR is a TTY.
|
||||
osmium::ProgressBar progress{reader.file_size(), osmium::isatty(2)};
|
||||
|
||||
// OSM data comes in buffers, read until there are no more.
|
||||
while (osmium::memory::Buffer buffer = reader.read()) {
|
||||
while (const osmium::memory::Buffer buffer = reader.read()) {
|
||||
// Update progress bar for each buffer.
|
||||
progress.update(reader.offset());
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
// Create a tile at this location. This will also internally use the
|
||||
// Mercator projection and then calculate the tile coordinates.
|
||||
const osmium::geom::Tile tile{uint32_t(zoom), location};
|
||||
const osmium::geom::Tile tile{static_cast<uint32_t>(zoom), location};
|
||||
std::cout << "Tile: zoom=" << tile.z << " x=" << tile.x << " y=" << tile.y << "\n";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user