Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (5)
New upstream version 2.15.1
· 8ffcda19
Bas Couwenberg
authored
Feb 26, 2019
8ffcda19
Merge tag 'upstream/2.15.1'
· 7991ac13
Bas Couwenberg
authored
Feb 26, 2019
Upstream version 2.15.1
7991ac13
New upstream release.
· 6bc1ec60
Bas Couwenberg
authored
Feb 26, 2019
6bc1ec60
Update copyright years for Jochen Topf.
· 425b78bf
Bas Couwenberg
authored
Feb 26, 2019
425b78bf
Set distribution to unstable.
· b313be45
Bas Couwenberg
authored
Feb 26, 2019
b313be45
Hide whitespace changes
Inline
Side-by-side
.clang-tidy
View file @
b313be45
---
Checks: '*,-android-cloexec-*,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-vararg,-fuchsia-*,-google-runtime-references,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-misc-macro-parentheses,-misc-unused-parameters,-modernize-make-unique,-modernize-raw-string-literal,-readability-avoid-const-params-in-decls,-readability-implicit-bool-cast,-readability-implicit-bool-conversion'
Checks: '*,-android-cloexec-*,-
bugprone-macro-parentheses,-
cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-vararg,-fuchsia-*,-google-runtime-references,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-misc-macro-parentheses,-misc-unused-parameters,-modernize-make-unique,-modernize-raw-string-literal,-readability-avoid-const-params-in-decls,-readability-implicit-bool-cast,-readability-implicit-bool-conversion'
#
# For a list of check options, see:
# https://clang.llvm.org/extra/clang-tidy/checks/list.html
...
...
@@ -9,6 +9,10 @@ Checks: '*,-android-cloexec-*,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-op
# android-cloexec-*
# O_CLOEXEC isn't available on Windows making this non-portable.
#
# bugprone-macro-parentheses
# False positive in the only place where it reports something and
# disabling locally doesn't work.
#
# cert-dcl21-cpp
# It is unclear whether this is still a good recommendation in modern C++.
#
...
...
@@ -64,8 +68,7 @@ Checks: '*,-android-cloexec-*,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-op
# Too strict, sometimes calling vararg functions is necessary.
#
# misc-macro-parentheses
# False positive in the only place where it reports something and
# disabling locally doesn't work.
# Old name for bugprone-macro-parentheses.
#
# misc-unused-parameters
# Can't be fixed, because then Doxygen will complain. (In file
...
...
CHANGELOG.md
View file @
b313be45
...
...
@@ -13,6 +13,27 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Fixed
## [2.15.1] - 2019-02-26
### Added
*
More tests.
*
CMake config: also find clang-tidy-7.
### Changed
*
Example and benchmark programs now don't crash with exceptions any more
but report them properly.
### Fixed
*
Compile with NDEBUG in RelWithDebInfo mode.
*
Correctly throw exception in
`multimap::dump_as_list()`
.
*
Integer truncation on 32 bit systems in
`MemoryUsage`
.
*
Exception specification on some functions.
*
Forwarding references that might have hidden copy/move constructors.
## [2.15.0] - 2018-12-07
### Added
...
...
@@ -897,7 +918,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
Doxygen (up to version 1.8.8). This version contains a workaround to fix
this.
[
unreleased
]:
https://github.com/osmcode/libosmium/compare/v2.15.0...HEAD
[
unreleased
]:
https://github.com/osmcode/libosmium/compare/v2.15.1...HEAD
[
2.15.1
]:
https://github.com/osmcode/libosmium/compare/v2.15.0...v2.15.1
[
2.15.0
]:
https://github.com/osmcode/libosmium/compare/v2.14.2...v2.15.0
[
2.14.2
]:
https://github.com/osmcode/libosmium/compare/v2.14.1...v2.14.2
[
2.14.1
]:
https://github.com/osmcode/libosmium/compare/v2.14.0...v2.14.1
...
...
CMakeLists.txt
View file @
b313be45
...
...
@@ -40,7 +40,7 @@ project(libosmium)
set
(
LIBOSMIUM_VERSION_MAJOR 2
)
set
(
LIBOSMIUM_VERSION_MINOR 15
)
set
(
LIBOSMIUM_VERSION_PATCH
0
)
set
(
LIBOSMIUM_VERSION_PATCH
1
)
set
(
LIBOSMIUM_VERSION
"
${
LIBOSMIUM_VERSION_MAJOR
}
.
${
LIBOSMIUM_VERSION_MINOR
}
.
${
LIBOSMIUM_VERSION_PATCH
}
"
)
...
...
@@ -206,11 +206,13 @@ endif()
#
#-----------------------------------------------------------------------------
if
(
MSVC
)
set
(
USUAL_COMPILE_OPTIONS
"/Ox"
)
set
(
DEV_COMPILE_OPTIONS
"/Ox"
)
set
(
RWD_COMPILE_OPTIONS
"/Ox /DNDEBUG"
)
# do not show warnings caused by missing .pdb files for libraries
set
(
USUAL_LINK_OPTIONS
"/debug /ignore:4099"
)
else
()
set
(
USUAL_COMPILE_OPTIONS
"-O3 -g"
)
set
(
DEV_COMPILE_OPTIONS
"-O3 -g"
)
set
(
RWD_COMPILE_OPTIONS
"-O3 -g -DNDEBUG"
)
set
(
USUAL_LINK_OPTIONS
""
)
endif
()
...
...
@@ -218,7 +220,7 @@ if(WIN32)
add_definitions
(
-DWIN32 -D_WIN32 -DMSWIN32 -DBGDWIN32
)
endif
()
set
(
CMAKE_CXX_FLAGS_DEV
"
${
USUAL
_COMPILE_OPTIONS
}
"
set
(
CMAKE_CXX_FLAGS_DEV
"
${
DEV
_COMPILE_OPTIONS
}
"
CACHE STRING
"Flags used by the compiler during developer builds."
FORCE
)
...
...
@@ -230,7 +232,7 @@ mark_as_advanced(
CMAKE_EXE_LINKER_FLAGS_DEV
)
set
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"
${
USUAL
_COMPILE_OPTIONS
}
"
set
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"
${
RWD
_COMPILE_OPTIONS
}
"
CACHE STRING
"Flags used by the compiler during RELWITHDEBINFO builds."
FORCE
)
...
...
@@ -422,7 +424,7 @@ endif()
#
#-----------------------------------------------------------------------------
message
(
STATUS
"Looking for clang-tidy"
)
find_program
(
CLANG_TIDY NAMES clang-tidy clang-tidy-7.0 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
)
message
(
STATUS
"Looking for clang-tidy - found
${
CLANG_TIDY
}
"
)
...
...
README.md
View file @
b313be45
...
...
@@ -7,7 +7,7 @@ A fast and flexible C++ library for working with OpenStreetMap data.
Libosmium works on Linux, Mac OSX and Windows.
[
![Travis Build Status
](
https://secure.travis-ci.org/osmcode/libosmium.svg
)
](https://travis-ci.org/osmcode/libosmium)
[
![Appveyor Build
S
tatus
](
https://ci.appveyor.com/api/projects/status/
github/osmcode/libosmium
?svg=true
)
](https://ci.appveyor.com/project/
Mapbox
/libosmium)
[
![Appveyor Build
s
tatus
](
https://ci.appveyor.com/api/projects/status/
ep07l3x5rk3hd8sp/branch/master
?svg=true
)
](https://ci.appveyor.com/project/
lonvia
/libosmium
/branch/master
)
[
![Coverage Status
](
https://codecov.io/gh/osmcode/libosmium/branch/master/graph/badge.svg
)
](https://codecov.io/gh/osmcode/libosmium)
[
![Packaging status
](
https://repology.org/badge/tiny-repos/libosmium.svg
)
](https://repology.org/metapackage/libosmium)
...
...
appveyor.yml
View file @
b313be45
...
...
@@ -14,8 +14,6 @@ clone_depth: 1
environment
:
matrix
:
-
config
:
MSYS2
autocrlf
:
true
-
config
:
Debug
autocrlf
:
true
-
config
:
Release
...
...
@@ -24,6 +22,8 @@ environment:
autocrlf
:
false
-
config
:
Release
autocrlf
:
false
-
config
:
MSYS2
autocrlf
:
true
#-----------------------------------------------------------------------------
...
...
benchmarks/osmium_benchmark_count.cpp
View file @
b313be45
...
...
@@ -39,16 +39,21 @@ int main(int argc, char* argv[]) {
std
::
exit
(
1
);
}
const
std
::
string
input_filename
{
argv
[
1
]};
try
{
const
std
::
string
input_filename
{
argv
[
1
]};
osmium
::
io
::
Reader
reader
{
input_filename
};
osmium
::
io
::
Reader
reader
{
input_filename
};
CountHandler
handler
;
osmium
::
apply
(
reader
,
handler
);
reader
.
close
();
CountHandler
handler
;
osmium
::
apply
(
reader
,
handler
);
reader
.
close
();
std
::
cout
<<
"Nodes: "
<<
handler
.
nodes
<<
'\n'
;
std
::
cout
<<
"Ways: "
<<
handler
.
ways
<<
'\n'
;
std
::
cout
<<
"Relations: "
<<
handler
.
relations
<<
'\n'
;
std
::
cout
<<
"Nodes: "
<<
handler
.
nodes
<<
'\n'
;
std
::
cout
<<
"Ways: "
<<
handler
.
ways
<<
'\n'
;
std
::
cout
<<
"Relations: "
<<
handler
.
relations
<<
'\n'
;
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
std
::
exit
(
1
);
}
}
benchmarks/osmium_benchmark_count_tag.cpp
View file @
b313be45
...
...
@@ -42,14 +42,19 @@ int main(int argc, char* argv[]) {
std
::
exit
(
1
);
}
const
std
::
string
input_filename
{
argv
[
1
]};
try
{
const
std
::
string
input_filename
{
argv
[
1
]};
osmium
::
io
::
Reader
reader
{
input_filename
};
osmium
::
io
::
Reader
reader
{
input_filename
};
CountHandler
handler
;
osmium
::
apply
(
reader
,
handler
);
reader
.
close
();
CountHandler
handler
;
osmium
::
apply
(
reader
,
handler
);
reader
.
close
();
std
::
cout
<<
"r_all="
<<
handler
.
all
<<
" r_counter="
<<
handler
.
counter
<<
'\n'
;
std
::
cout
<<
"r_all="
<<
handler
.
all
<<
" r_counter="
<<
handler
.
counter
<<
'\n'
;
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
std
::
exit
(
1
);
}
}
benchmarks/osmium_benchmark_index_map.cpp
View file @
b313be45
...
...
@@ -24,17 +24,22 @@ int main(int argc, char* argv[]) {
std
::
exit
(
1
);
}
const
std
::
string
input_filename
{
argv
[
1
]};
const
std
::
string
location_store
{
argv
[
2
]};
try
{
const
std
::
string
input_filename
{
argv
[
1
]};
const
std
::
string
location_store
{
argv
[
2
]};
osmium
::
io
::
Reader
reader
{
input_filename
};
osmium
::
io
::
Reader
reader
{
input_filename
};
const
auto
&
map_factory
=
osmium
::
index
::
MapFactory
<
osmium
::
unsigned_object_id_type
,
osmium
::
Location
>::
instance
();
std
::
unique_ptr
<
index_type
>
index
=
map_factory
.
create_map
(
location_store
);
location_handler_type
location_handler
{
*
index
};
location_handler
.
ignore_errors
();
const
auto
&
map_factory
=
osmium
::
index
::
MapFactory
<
osmium
::
unsigned_object_id_type
,
osmium
::
Location
>::
instance
();
std
::
unique_ptr
<
index_type
>
index
=
map_factory
.
create_map
(
location_store
);
location_handler_type
location_handler
{
*
index
};
location_handler
.
ignore_errors
();
osmium
::
apply
(
reader
,
location_handler
);
reader
.
close
();
osmium
::
apply
(
reader
,
location_handler
);
reader
.
close
();
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
std
::
exit
(
1
);
}
}
benchmarks/osmium_benchmark_mercator.cpp
View file @
b313be45
...
...
@@ -31,12 +31,17 @@ int main(int argc, char* argv[]) {
std
::
exit
(
1
);
}
const
std
::
string
input_filename
{
argv
[
1
]};
try
{
const
std
::
string
input_filename
{
argv
[
1
]};
osmium
::
io
::
Reader
reader
{
input_filename
};
osmium
::
io
::
Reader
reader
{
input_filename
};
GeomHandler
handler
;
osmium
::
apply
(
reader
,
handler
);
reader
.
close
();
GeomHandler
handler
;
osmium
::
apply
(
reader
,
handler
);
reader
.
close
();
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
std
::
exit
(
1
);
}
}
benchmarks/osmium_benchmark_static_vs_dynamic_index.cpp
View file @
b313be45
...
...
@@ -44,101 +44,106 @@ int main(int argc, char* argv[]) {
std
::
exit
(
1
);
}
const
std
::
string
input_filename
{
argv
[
1
]};
try
{
const
std
::
string
input_filename
{
argv
[
1
]};
osmium
::
memory
::
Buffer
buffer
{
osmium
::
io
::
read_file
(
input_filename
)};
osmium
::
memory
::
Buffer
buffer
{
osmium
::
io
::
read_file
(
input_filename
)};
const
auto
&
map_factory
=
osmium
::
index
::
MapFactory
<
osmium
::
unsigned_object_id_type
,
osmium
::
Location
>::
instance
();
const
auto
&
map_factory
=
osmium
::
index
::
MapFactory
<
osmium
::
unsigned_object_id_type
,
osmium
::
Location
>::
instance
();
const
auto
buffer_size
=
buffer
.
committed
()
/
(
1024
*
1024
);
// buffer size in MBytes
const
int
runs
=
std
::
max
(
10
,
static_cast
<
int
>
(
5000ull
/
buffer_size
));
const
auto
buffer_size
=
buffer
.
committed
()
/
(
1024
*
1024
);
// buffer size in MBytes
const
int
runs
=
std
::
max
(
10
,
static_cast
<
int
>
(
5000ull
/
buffer_size
));
std
::
cout
<<
"input: filename="
<<
input_filename
<<
" buffer_size="
<<
buffer_size
<<
"MBytes
\n
"
;
std
::
cout
<<
"runs: "
<<
runs
<<
"
\n
"
;
std
::
cout
<<
"input: filename="
<<
input_filename
<<
" buffer_size="
<<
buffer_size
<<
"MBytes
\n
"
;
std
::
cout
<<
"runs: "
<<
runs
<<
"
\n
"
;
double
static_min
=
std
::
numeric_limits
<
double
>::
max
();
double
static_sum
=
0
;
double
static_max
=
0
;
double
static_min
=
std
::
numeric_limits
<
double
>::
max
();
double
static_sum
=
0
;
double
static_max
=
0
;
double
dynamic_min
=
std
::
numeric_limits
<
double
>::
max
();
double
dynamic_sum
=
0
;
double
dynamic_max
=
0
;
double
dynamic_min
=
std
::
numeric_limits
<
double
>::
max
();
double
dynamic_sum
=
0
;
double
dynamic_max
=
0
;
for
(
int
i
=
0
;
i
<
runs
;
++
i
)
{
for
(
int
i
=
0
;
i
<
runs
;
++
i
)
{
{
// static index
osmium
::
memory
::
Buffer
tmp_buffer
{
buffer
.
committed
()};
for
(
const
auto
&
item
:
buffer
)
{
tmp_buffer
.
add_item
(
item
);
tmp_buffer
.
commit
();
}
static_index_type
static_index
;
static_location_handler_type
static_location_handler
{
static_index
};
{
// static index
osmium
::
memory
::
Buffer
tmp_buffer
{
buffer
.
committed
()};
for
(
const
auto
&
item
:
buffer
)
{
tmp_buffer
.
add_item
(
item
);
tmp_buffer
.
commit
();
}
const
auto
start
=
std
::
chrono
::
steady_clock
::
now
();
osmium
::
apply
(
tmp_buffer
,
static_location_handler
);
const
auto
end
=
std
::
chrono
::
steady_clock
::
now
();
static_index_type
static_index
;
static_location_handler_type
static_location_handler
{
static_index
};
const
double
duration
=
std
::
chrono
::
duration
<
double
,
std
::
milli
>
(
end
-
start
).
count
();
const
auto
start
=
std
::
chrono
::
steady_clock
::
now
();
osmium
::
apply
(
tmp_buffer
,
static_location_handler
);
const
auto
end
=
std
::
chrono
::
steady_clock
::
now
();
if
(
duration
<
static_min
)
{
static_min
=
duration
;
}
if
(
duration
>
static_max
)
{
static_max
=
duration
;
}
static_sum
+=
duration
;
}
const
double
duration
=
std
::
chrono
::
duration
<
double
,
std
::
milli
>
(
end
-
start
).
count
();
{
// dynamic index
osmium
::
memory
::
Buffer
tmp_buffer
{
buffer
.
committed
()};
for
(
const
auto
&
item
:
buffer
)
{
tmp_buffer
.
add_item
(
item
);
tmp_buffer
.
commit
();
if
(
duration
<
static_min
)
{
static_min
=
duration
;
}
if
(
duration
>
static_max
)
{
static_max
=
duration
;
}
static_sum
+=
duration
;
}
std
::
unique_ptr
<
dynamic_index_type
>
index
=
map_factory
.
create_map
(
location_store
);
dynamic_location_handler_type
dynamic_location_handler
{
*
index
};
dynamic_location_handler
.
ignore_errors
();
const
auto
start
=
std
::
chrono
::
steady_clock
::
now
();
osmium
::
apply
(
tmp_buffer
,
dynamic_location_handler
);
const
auto
end
=
std
::
chrono
::
steady_clock
::
now
();
const
double
duration
=
std
::
chrono
::
duration
<
double
,
std
::
milli
>
(
end
-
start
).
count
();
if
(
duration
<
dynamic_min
)
{
dynamic_min
=
duration
;
}
if
(
duration
>
dynamic_max
)
{
dynamic_max
=
duration
;
{
// dynamic index
osmium
::
memory
::
Buffer
tmp_buffer
{
buffer
.
committed
()};
for
(
const
auto
&
item
:
buffer
)
{
tmp_buffer
.
add_item
(
item
);
tmp_buffer
.
commit
();
}
std
::
unique_ptr
<
dynamic_index_type
>
index
=
map_factory
.
create_map
(
location_store
);
dynamic_location_handler_type
dynamic_location_handler
{
*
index
};
dynamic_location_handler
.
ignore_errors
();
const
auto
start
=
std
::
chrono
::
steady_clock
::
now
();
osmium
::
apply
(
tmp_buffer
,
dynamic_location_handler
);
const
auto
end
=
std
::
chrono
::
steady_clock
::
now
();
const
double
duration
=
std
::
chrono
::
duration
<
double
,
std
::
milli
>
(
end
-
start
).
count
();
if
(
duration
<
dynamic_min
)
{
dynamic_min
=
duration
;
}
if
(
duration
>
dynamic_max
)
{
dynamic_max
=
duration
;
}
dynamic_sum
+=
duration
;
}
dynamic_sum
+=
duration
;
}
}
const
double
static_avg
=
static_sum
/
runs
;
const
double
dynamic_avg
=
dynamic_sum
/
runs
;
const
double
static_avg
=
static_sum
/
runs
;
const
double
dynamic_avg
=
dynamic_sum
/
runs
;
std
::
cout
<<
"static min="
<<
static_min
<<
"ms avg="
<<
static_avg
<<
"ms max="
<<
static_max
<<
"ms
\n
"
;
std
::
cout
<<
"dynamic min="
<<
dynamic_min
<<
"ms avg="
<<
dynamic_avg
<<
"ms max="
<<
dynamic_max
<<
"ms
\n
"
;
std
::
cout
<<
"static min="
<<
static_min
<<
"ms avg="
<<
static_avg
<<
"ms max="
<<
static_max
<<
"ms
\n
"
;
std
::
cout
<<
"dynamic min="
<<
dynamic_min
<<
"ms avg="
<<
dynamic_avg
<<
"ms max="
<<
dynamic_max
<<
"ms
\n
"
;
const
double
rfactor
=
100.0
;
const
double
diff_min
=
std
::
round
((
dynamic_min
-
static_min
)
*
rfactor
)
/
rfactor
;
const
double
diff_avg
=
std
::
round
((
dynamic_avg
-
static_avg
)
*
rfactor
)
/
rfactor
;
const
double
diff_max
=
std
::
round
((
dynamic_max
-
static_max
)
*
rfactor
)
/
rfactor
;
const
double
rfactor
=
100.0
;
const
double
diff_min
=
std
::
round
((
dynamic_min
-
static_min
)
*
rfactor
)
/
rfactor
;
const
double
diff_avg
=
std
::
round
((
dynamic_avg
-
static_avg
)
*
rfactor
)
/
rfactor
;
const
double
diff_max
=
std
::
round
((
dynamic_max
-
static_max
)
*
rfactor
)
/
rfactor
;
const
double
prfactor
=
10.0
;
const
double
percent_min
=
std
::
round
((
100.0
*
diff_min
/
static_min
)
*
prfactor
)
/
prfactor
;
const
double
percent_avg
=
std
::
round
((
100.0
*
diff_avg
/
static_avg
)
*
prfactor
)
/
prfactor
;
const
double
percent_max
=
std
::
round
((
100.0
*
diff_max
/
static_max
)
*
prfactor
)
/
prfactor
;
const
double
prfactor
=
10.0
;
const
double
percent_min
=
std
::
round
((
100.0
*
diff_min
/
static_min
)
*
prfactor
)
/
prfactor
;
const
double
percent_avg
=
std
::
round
((
100.0
*
diff_avg
/
static_avg
)
*
prfactor
)
/
prfactor
;
const
double
percent_max
=
std
::
round
((
100.0
*
diff_max
/
static_max
)
*
prfactor
)
/
prfactor
;
std
::
cout
<<
"difference:"
;
std
::
cout
<<
" min="
<<
diff_min
<<
"ms ("
<<
percent_min
<<
"%)"
;
std
::
cout
<<
" avg="
<<
diff_avg
<<
"ms ("
<<
percent_avg
<<
"%)"
;
std
::
cout
<<
" max="
<<
diff_max
<<
"ms ("
<<
percent_max
<<
"%)
\n
"
;
std
::
cout
<<
"difference:"
;
std
::
cout
<<
" min="
<<
diff_min
<<
"ms ("
<<
percent_min
<<
"%)"
;
std
::
cout
<<
" avg="
<<
diff_avg
<<
"ms ("
<<
percent_avg
<<
"%)"
;
std
::
cout
<<
" max="
<<
diff_max
<<
"ms ("
<<
percent_max
<<
"%)
\n
"
;
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
std
::
exit
(
1
);
}
}
benchmarks/osmium_benchmark_write_pbf.cpp
View file @
b313be45
...
...
@@ -17,19 +17,24 @@ int main(int argc, char* argv[]) {
std
::
exit
(
1
);
}
std
::
string
input_filename
{
argv
[
1
]};
std
::
string
output_filename
{
argv
[
2
]};
osmium
::
io
::
Reader
reader
{
input_filename
};
osmium
::
io
::
File
output_file
{
output_filename
,
"pbf"
};
osmium
::
io
::
Header
header
;
osmium
::
io
::
Writer
writer
{
output_file
,
header
,
osmium
::
io
::
overwrite
::
allow
};
while
(
osmium
::
memory
::
Buffer
buffer
=
reader
.
read
())
{
// NOLINT(bugprone-use-after-move) Bug in clang-tidy https://bugs.llvm.org/show_bug.cgi?id=36516
writer
(
std
::
move
(
buffer
));
try
{
std
::
string
input_filename
{
argv
[
1
]};
std
::
string
output_filename
{
argv
[
2
]};
osmium
::
io
::
Reader
reader
{
input_filename
};
osmium
::
io
::
File
output_file
{
output_filename
,
"pbf"
};
osmium
::
io
::
Header
header
;
osmium
::
io
::
Writer
writer
{
output_file
,
header
,
osmium
::
io
::
overwrite
::
allow
};
while
(
osmium
::
memory
::
Buffer
buffer
=
reader
.
read
())
{
// NOLINT(bugprone-use-after-move) Bug in clang-tidy https://bugs.llvm.org/show_bug.cgi?id=36516
writer
(
std
::
move
(
buffer
));
}
writer
.
close
();
reader
.
close
();
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
std
::
exit
(
1
);
}
writer
.
close
();
reader
.
close
();
}
debian/changelog
View file @
b313be45
libosmium (2.15.
0-2) UNRELEASED
; urgency=medium
libosmium (2.15.
1-1) unstable
; urgency=medium
* New upstream release.
* Bump Standards-Version to 4.3.0, no changes.
* Update copyright years for Jochen Topf.
-- Bas Couwenberg <sebastic@debian.org> Tue, 2
5 Dec 2018 22:31:31
+0100
-- Bas Couwenberg <sebastic@debian.org> Tue, 2
6 Feb 2019 17:12:59
+0100
libosmium (2.15.0-1) unstable; urgency=medium
...
...
debian/copyright
View file @
b313be45
...
...
@@ -4,7 +4,7 @@ Upstream-Contact: Osmium Developers (https://osmcode.org/contact)
Source: https://github.com/osmcode/libosmium
Files: *
Copyright: 2013-201
8
, Jochen Topf <jochen@topf.org>
Copyright: 2013-201
9
, Jochen Topf <jochen@topf.org>
2012, Two Blue Cubes Ltd.
License: BSL-1.0
...
...
@@ -29,7 +29,7 @@ License: public-domain
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Files: debian/*
Copyright:
©
2015, Bas Couwenberg <sebastic@debian.org>
Copyright: 2015, Bas Couwenberg <sebastic@debian.org>
License: GPL-2+
License: BSL-1.0
...
...
examples/osmium_amenity_list.cpp
View file @
b313be45
...
...
@@ -113,59 +113,65 @@ int main(int argc, char* argv[]) {
std
::
exit
(
1
);
}
// The input file
const
osmium
::
io
::
File
input_file
{
argv
[
1
]};
// Configuration for the multipolygon assembler. We disable the option to
// create empty areas when invalid multipolygons are encountered. This
// means areas created have a valid geometry and invalid multipolygons
// are simply ignored.
osmium
::
area
::
Assembler
::
config_type
assembler_config
;
assembler_config
.
create_empty_areas
=
false
;
// Initialize the MultipolygonManager. Its job is to collect all
// relations and member ways needed for each area. It then calls an
// instance of the osmium::area::Assembler class (with the given config)
// to actually assemble one area.
osmium
::
area
::
MultipolygonManager
<
osmium
::
area
::
Assembler
>
mp_manager
{
assembler_config
};
// We read the input file twice. In the first pass, only relations are
// read and fed into the multipolygon manager.
std
::
cerr
<<
"Pass 1...
\n
"
;
osmium
::
relations
::
read_relations
(
input_file
,
mp_manager
);
std
::
cerr
<<
"Pass 1 done
\n
"
;
// The index storing all node locations.
index_type
index
;
// The handler that stores all node locations in the index and adds them
// to the ways.
location_handler_type
location_handler
{
index
};
// If a location is not available in the index, we ignore it. It might
// not be needed (if it is not part of a multipolygon relation), so why
// create an error?
location_handler
.
ignore_errors
();
// Create our handler.
AmenityHandler
data_handler
;
// On the second pass we read all objects and run them first through the
// node location handler and then the multipolygon manager. The manager
// will put the areas it has created into the "buffer" which are then
// fed through our handler.
//
// The read_meta::no option disables reading of meta data (such as version
// numbers, timestamps, etc.) which are not needed in this case. Disabling
// this can speed up your program.
std
::
cerr
<<
"Pass 2...
\n
"
;
osmium
::
io
::
Reader
reader
{
input_file
,
osmium
::
io
::
read_meta
::
no
};
osmium
::
apply
(
reader
,
location_handler
,
data_handler
,
mp_manager
.
handler
([
&
data_handler
](
const
osmium
::
memory
::
Buffer
&
area_buffer
)
{
osmium
::
apply
(
area_buffer
,
data_handler
);
}));
reader
.
close
();
std
::
cerr
<<
"Pass 2 done
\n
"
;
try
{
// The input file
const
osmium
::
io
::
File
input_file
{
argv
[
1
]};
// Configuration for the multipolygon assembler. We disable the option to
// create empty areas when invalid multipolygons are encountered. This
// means areas created have a valid geometry and invalid multipolygons
// are simply ignored.
osmium
::
area
::
Assembler
::
config_type
assembler_config
;
assembler_config
.
create_empty_areas
=
false
;
// Initialize the MultipolygonManager. Its job is to collect all
// relations and member ways needed for each area. It then calls an
// instance of the osmium::area::Assembler class (with the given config)
// to actually assemble one area.
osmium
::
area
::
MultipolygonManager
<
osmium
::
area
::
Assembler
>
mp_manager
{
assembler_config
};
// We read the input file twice. In the first pass, only relations are
// read and fed into the multipolygon manager.
std
::
cerr
<<
"Pass 1...
\n
"
;
osmium
::
relations
::
read_relations
(
input_file
,
mp_manager
);
std
::
cerr
<<
"Pass 1 done
\n
"
;
// The index storing all node locations.
index_type
index
;
// The handler that stores all node locations in the index and adds them
// to the ways.
location_handler_type
location_handler
{
index
};
// If a location is not available in the index, we ignore it. It might
// not be needed (if it is not part of a multipolygon relation), so why
// create an error?
location_handler
.
ignore_errors
();
// Create our handler.
AmenityHandler
data_handler
;
// On the second pass we read all objects and run them first through the
// node location handler and then the multipolygon manager. The manager
// will put the areas it has created into the "buffer" which are then
// fed through our handler.
//
// The read_meta::no option disables reading of meta data (such as version
// numbers, timestamps, etc.) which are not needed in this case. Disabling
// this can speed up your program.
std
::
cerr
<<
"Pass 2...
\n
"
;
osmium
::
io
::
Reader
reader
{
input_file
,
osmium
::
io
::
read_meta
::
no
};
osmium
::
apply
(
reader
,
location_handler
,
data_handler
,
mp_manager
.
handler
([
&
data_handler
](
const
osmium
::
memory
::
Buffer
&
area_buffer
)
{
osmium
::
apply
(
area_buffer
,
data_handler
);
}));
reader
.
close
();
std
::
cerr
<<
"Pass 2 done
\n
"
;
}
catch
(
const
std
::
exception
&
e
)
{
// All exceptions used by the Osmium library derive from std::exception.
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
std
::
exit
(
1
);
}
}
examples/osmium_area_test.cpp
View file @
b313be45
...
...
@@ -107,92 +107,98 @@ int main(int argc, char* argv[]) {
print_usage
(
argv
[
0
]);
}
// Initialize an empty DynamicHandler. Later it will be associated
// with one of the handlers. You can think of the DynamicHandler as
// a kind of "variant handler" or a "pointer handler" pointing to the
// real handler.
osmium
::
handler
::
DynamicHandler
handler
;
if
(
!
std
::
strcmp
(
argv
[
1
],
"-w"
)
||
!
std
::
strcmp
(
argv
[
1
],
"--dump-wkt"
))
{
handler
.
set
<
WKTDump
>
();
}
else
if
(
!
std
::
strcmp
(
argv
[
1
],
"-o"
)
||
!
std
::
strcmp
(
argv
[
1
],
"--dump-objects"
))
{
handler
.
set
<
osmium
::
handler
::
Dump
>
(
std
::
cout
);
}
else
{
print_usage
(
argv
[
0
]);
}
try
{
// Initialize an empty DynamicHandler. Later it will be associated
// with one of the handlers. You can think of the DynamicHandler as
// a kind of "variant handler" or a "pointer handler" pointing to the
// real handler.
osmium
::
handler
::
DynamicHandler
handler
;
if
(
!
std
::
strcmp
(
argv
[
1
],
"-w"
)
||
!
std
::
strcmp
(
argv
[
1
],
"--dump-wkt"
))
{
handler
.
set
<
WKTDump
>
();
}
else
if
(
!
std
::
strcmp
(
argv
[
1
],
"-o"
)
||
!
std
::
strcmp
(
argv
[
1
],
"--dump-objects"
))
{
handler
.
set
<
osmium
::
handler
::
Dump
>
(
std
::
cout
);
}
else
{
print_usage
(
argv
[
0
]);
}
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
;
// Set up a filter matching only forests. This will be used to only build
// areas with matching tags.
osmium
::
TagsFilter
filter
{
false
};
filter
.
add_rule
(
true
,
"landuse"
,
"forest"
);
filter
.
add_rule
(
true
,
"natural"
,
"wood"
);
// Initialize the MultipolygonManager. Its job is to collect all
// relations and member ways needed for each area. It then calls an
// instance of the osmium::area::Assembler class (with the given config)
// to actually assemble one area. The filter parameter is optional, if
// it is not set, all areas will be built.
osmium
::
area
::
MultipolygonManager
<
osmium
::
area
::
Assembler
>
mp_manager
{
assembler_config
,
filter
};
// We read the input file twice. In the first pass, only relations are
// read and fed into the multipolygon manager.
std
::
cerr
<<
"Pass 1...
\n
"
;
osmium
::
relations
::
read_relations
(
input_file
,
mp_manager
);
std
::
cerr
<<
"Pass 1 done
\n
"
;
// Output the amount of main memory used so far. All multipolygon relations
// are in memory now.
std
::
cerr
<<
"Memory:
\n
"
;
osmium
::
relations
::
print_used_memory
(
std
::
cerr
,
mp_manager
.
used_memory
());
// The index storing all node locations.
index_type
index
;
// The handler that stores all node locations in the index and adds them
// to the ways.
location_handler_type
location_handler
{
index
};
// If a location is not available in the index, we ignore it. It might
// not be needed (if it is not part of a multipolygon relation), so why
// create an error?
location_handler
.
ignore_errors
();
// On the second pass we read all objects and run them first through the
// node location handler and then the multipolygon collector. The collector
// will put the areas it has created into the "buffer" which are then
// fed through our "handler".
std
::
cerr
<<
"Pass 2...
\n
"
;
osmium
::
io
::
Reader
reader
{
input_file
};
osmium
::
apply
(
reader
,
location_handler
,
mp_manager
.
handler
([
&
handler
](
osmium
::
memory
::
Buffer
&&
buffer
)
{
osmium
::
apply
(
buffer
,
handler
);
}));
reader
.
close
();
std
::
cerr
<<
"Pass 2 done
\n
"
;
// Output the amount of main memory used so far. All complete multipolygon
// relations have been cleaned up.
std
::
cerr
<<
"Memory:
\n
"
;
osmium
::
relations
::
print_used_memory
(
std
::
cerr
,
mp_manager
.
used_memory
());
// If there were multipolgyon relations in the input, but some of their
// members are not in the input file (which often happens for extracts)
// this will write the IDs of the incomplete relations to stderr.
std
::
vector
<
osmium
::
object_id_type
>
incomplete_relations_ids
;
mp_manager
.
for_each_incomplete_relation
([
&
](
const
osmium
::
relations
::
RelationHandle
&
handle
){
incomplete_relations_ids
.
push_back
(
handle
->
id
());
});
if
(
!
incomplete_relations_ids
.
empty
())
{
std
::
cerr
<<
"Warning! Some member ways missing for these multipolygon relations:"
;
for
(
const
auto
id
:
incomplete_relations_ids
)
{
std
::
cerr
<<
" "
<<
id
;
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
;
// Set up a filter matching only forests. This will be used to only build
// areas with matching tags.
osmium
::
TagsFilter
filter
{
false
};
filter
.
add_rule
(
true
,
"landuse"
,
"forest"
);
filter
.
add_rule
(
true
,
"natural"
,
"wood"
);
// Initialize the MultipolygonManager. Its job is to collect all
// relations and member ways needed for each area. It then calls an
// instance of the osmium::area::Assembler class (with the given config)
// to actually assemble one area. The filter parameter is optional, if
// it is not set, all areas will be built.
osmium
::
area
::
MultipolygonManager
<
osmium
::
area
::
Assembler
>
mp_manager
{
assembler_config
,
filter
};
// We read the input file twice. In the first pass, only relations are
// read and fed into the multipolygon manager.
std
::
cerr
<<
"Pass 1...
\n
"
;
osmium
::
relations
::
read_relations
(
input_file
,
mp_manager
);
std
::
cerr
<<
"Pass 1 done
\n
"
;
// Output the amount of main memory used so far. All multipolygon relations
// are in memory now.
std
::
cerr
<<
"Memory:
\n
"
;
osmium
::
relations
::
print_used_memory
(
std
::
cerr
,
mp_manager
.
used_memory
());
// The index storing all node locations.
index_type
index
;
// The handler that stores all node locations in the index and adds them
// to the ways.
location_handler_type
location_handler
{
index
};
// If a location is not available in the index, we ignore it. It might
// not be needed (if it is not part of a multipolygon relation), so why
// create an error?
location_handler
.
ignore_errors
();
// On the second pass we read all objects and run them first through the
// node location handler and then the multipolygon collector. The collector
// will put the areas it has created into the "buffer" which are then
// fed through our "handler".
std
::
cerr
<<
"Pass 2...
\n
"
;
osmium
::
io
::
Reader
reader
{
input_file
};
osmium
::
apply
(
reader
,
location_handler
,
mp_manager
.
handler
([
&
handler
](
osmium
::
memory
::
Buffer
&&
buffer
)
{
osmium
::
apply
(
buffer
,
handler
);
}));
reader
.
close
();
std
::
cerr
<<
"Pass 2 done
\n
"
;
// Output the amount of main memory used so far. All complete multipolygon
// relations have been cleaned up.
std
::
cerr
<<
"Memory:
\n
"
;
osmium
::
relations
::
print_used_memory
(
std
::
cerr
,
mp_manager
.
used_memory
());
// If there were multipolgyon relations in the input, but some of their
// members are not in the input file (which often happens for extracts)
// this will write the IDs of the incomplete relations to stderr.
std
::
vector
<
osmium
::
object_id_type
>
incomplete_relations_ids
;
mp_manager
.
for_each_incomplete_relation
([
&
](
const
osmium
::
relations
::
RelationHandle
&
handle
){
incomplete_relations_ids
.
push_back
(
handle
->
id
());
});
if
(
!
incomplete_relations_ids
.
empty
())
{
std
::
cerr
<<
"Warning! Some member ways missing for these multipolygon relations:"
;
for
(
const
auto
id
:
incomplete_relations_ids
)
{
std
::
cerr
<<
" "
<<
id
;
}
std
::
cerr
<<
"
\n
"
;
}
std
::
cerr
<<
"
\n
"
;
}
catch
(
const
std
::
exception
&
e
)
{
// All exceptions used by the Osmium library derive from std::exception.
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
std
::
exit
(
1
);
}
}
examples/osmium_change_tags.cpp
View file @
b313be45
...
...
@@ -196,7 +196,7 @@ int main(int argc, char* argv[]) {
reader
.
close
();
}
catch
(
const
std
::
exception
&
e
)
{
// All exceptions used by the Osmium library derive from std::exception.
std
::
cerr
<<
e
.
what
()
<<
"
\n
"
;
std
::
cerr
<<
e
.
what
()
<<
'
\n
'
;
std
::
exit
(
1
);
}
}
...
...
examples/osmium_convert.cpp
View file @
b313be45
...
...
@@ -147,7 +147,7 @@ int main(int argc, char* argv[]) {
reader
.
close
();
}
catch
(
const
std
::
exception
&
e
)
{
// All exceptions used by the Osmium library derive from std::exception.
std
::
cerr
<<
e
.
what
()
<<
"
\n
"
;
std
::
cerr
<<
e
.
what
()
<<
'
\n
'
;
std
::
exit
(
1
);
}
}
...
...
examples/osmium_count.cpp
View file @
b313be45
...
...
@@ -66,30 +66,36 @@ int main(int argc, char* argv[]) {
std
::
exit
(
1
);
}
// 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
]};
osmium
::
io
::
Reader
reader
{
input_file
};
// Create an instance of our own CountHandler and push the data from the
// input file through it.
CountHandler
handler
;
osmium
::
apply
(
reader
,
handler
);
// You do not have to close the Reader explicitly, but because the
// destructor can't throw, you will not see any errors otherwise.
reader
.
close
();
std
::
cout
<<
"Nodes: "
<<
handler
.
nodes
<<
"
\n
"
;
std
::
cout
<<
"Ways: "
<<
handler
.
ways
<<
"
\n
"
;
std
::
cout
<<
"Relations: "
<<
handler
.
relations
<<
"
\n
"
;
// Because of the huge amount of OSM data, some Osmium-based programs
// (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 OSX and Windows.)
osmium
::
MemoryUsage
memory
;
std
::
cout
<<
"
\n
Memory used: "
<<
memory
.
peak
()
<<
" MBytes
\n
"
;
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
]};
osmium
::
io
::
Reader
reader
{
input_file
};
// Create an instance of our own CountHandler and push the data from the
// input file through it.
CountHandler
handler
;
osmium
::
apply
(
reader
,
handler
);
// You do not have to close the Reader explicitly, but because the
// destructor can't throw, you will not see any errors otherwise.
reader
.
close
();
std
::
cout
<<
"Nodes: "
<<
handler
.
nodes
<<
"
\n
"
;
std
::
cout
<<
"Ways: "
<<
handler
.
ways
<<
"
\n
"
;
std
::
cout
<<
"Relations: "
<<
handler
.
relations
<<
"
\n
"
;
// Because of the huge amount of OSM data, some Osmium-based programs
// (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 OSX and Windows.)
osmium
::
MemoryUsage
memory
;
std
::
cout
<<
"
\n
Memory used: "
<<
memory
.
peak
()
<<
" MBytes
\n
"
;
}
catch
(
const
std
::
exception
&
e
)
{
// All exceptions used by the Osmium library derive from std::exception.
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
std
::
exit
(
1
);
}
}
examples/osmium_create_pois.cpp
View file @
b313be45
...
...
@@ -93,7 +93,7 @@ int main(int argc, char* argv[]) {
writer
.
close
();
}
catch
(
const
std
::
exception
&
e
)
{
// All exceptions used by the Osmium library derive from std::exception.
std
::
cerr
<<
e
.
what
()
<<
"
\n
"
;
std
::
cerr
<<
e
.
what
()
<<
'
\n
'
;
std
::
exit
(
1
);
}
}
...
...
examples/osmium_debug.cpp
View file @
b313be45
...
...
@@ -37,48 +37,54 @@ int main(int argc, char* argv[]) {
std
::
exit
(
1
);
}
// Default is all entity types: nodes, ways, relations, and changesets
osmium
::
osm_entity_bits
::
type
read_types
=
osmium
::
osm_entity_bits
::
all
;
// 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
];
if
(
types
.
find
(
'n'
)
!=
std
::
string
::
npos
)
{
read_types
|=
osmium
::
osm_entity_bits
::
node
;
try
{
// Default is all entity types: nodes, ways, relations, and changesets
osmium
::
osm_entity_bits
::
type
read_types
=
osmium
::
osm_entity_bits
::
all
;
// 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
];
if
(
types
.
find
(
'n'
)
!=
std
::
string
::
npos
)
{
read_types
|=
osmium
::
osm_entity_bits
::
node
;
}
if
(
types
.
find
(
'w'
)
!=
std
::
string
::
npos
)
{
read_types
|=
osmium
::
osm_entity_bits
::
way
;
}
if
(
types
.
find
(
'r'
)
!=
std
::
string
::
npos
)
{
read_types
|=
osmium
::
osm_entity_bits
::
relation
;
}
if
(
types
.
find
(
'c'
)
!=
std
::
string
::
npos
)
{
read_types
|=
osmium
::
osm_entity_bits
::
changeset
;
}
}
if
(
types
.
find
(
'w'
)
!=
std
::
string
::
npos
)
{
read_types
|=
osmium
::
osm_entity_bits
::
way
;
}
if
(
types
.
find
(
'r'
)
!=
std
::
string
::
npos
)
{
read_types
|=
osmium
::
osm_entity_bits
::
relation
;
}
if
(
types
.
find
(
'c'
)
!=
std
::
string
::
npos
)
{
read_types
|=
osmium
::
osm_entity_bits
::
changeset
;
}
}
// Initialize Reader with file name and the types of entities we want to
// read.
osmium
::
io
::
Reader
reader
{
argv
[
1
],
read_types
};
// Initialize Reader with file name and the types of entities we want to
// read.
osmium
::
io
::
Reader
reader
{
argv
[
1
],
read_types
};
// The file header can contain metadata such as the program that generated
// the file and the bounding box of the data.
osmium
::
io
::
Header
header
=
reader
.
header
();
std
::
cout
<<
"HEADER:
\n
generator="
<<
header
.
get
(
"generator"
)
<<
"
\n
"
;
// The file header can contain metadata such as the program that generated
// the file and the bounding box of the data.
osmium
::
io
::
Header
header
=
reader
.
header
();
std
::
cout
<<
"HEADER:
\n
generator="
<<
header
.
get
(
"generator"
)
<<
"
\n
"
;
for
(
const
auto
&
bbox
:
header
.
boxes
())
{
std
::
cout
<<
" bbox="
<<
bbox
<<
"
\n
"
;
}
for
(
const
auto
&
bbox
:
header
.
boxes
())
{
std
::
cout
<<
" bbox="
<<
bbox
<<
"
\n
"
;
}
// Initialize Dump handler.
osmium
::
handler
::
Dump
dump
{
std
::
cout
};
// Initialize Dump handler.
osmium
::
handler
::
Dump
dump
{
std
::
cout
};
// Read from input and send everything to Dump handler.
osmium
::
apply
(
reader
,
dump
);
// Read from input and send everything to Dump handler.
osmium
::
apply
(
reader
,
dump
);
// You do not have to close the Reader explicitly, but because the
// destructor can't throw, you will not see any errors otherwise.
reader
.
close
();
// You do not have to close the Reader explicitly, but because the
// destructor can't throw, you will not see any errors otherwise.
reader
.
close
();
}
catch
(
const
std
::
exception
&
e
)
{
// All exceptions used by the Osmium library derive from std::exception.
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
std
::
exit
(
1
);
}
}
Prev
1
2
3
4
5
…
12
Next