[osmium-tool] 01/07: New upstream version 1.7.1

Bas Couwenberg sebastic at debian.org
Sat Aug 26 08:05:48 UTC 2017


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository osmium-tool.

commit 6be5d59daf31a62e768aa99369eac24e310b0522
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sat Aug 26 08:58:30 2017 +0200

    New upstream version 1.7.1
---
 CHANGELOG.md                          | 24 +++++++++-
 CMakeLists.txt                        | 84 ++---------------------------------
 README.md                             |  2 +-
 man/CMakeLists.txt                    | 79 ++++++++++++++++++++++++++++++++
 man/osmium-add-locations-to-ways.md   |  6 ++-
 man/osmium-apply-changes.md           |  4 ++
 man/osmium-cat.md                     |  4 ++
 man/osmium-changeset-filter.md        |  4 ++
 man/osmium-check-refs.md              |  1 +
 man/osmium-derive-changes.md          |  4 ++
 man/osmium-file-formats.md            | 44 ++++++++++++++++--
 man/osmium-fileinfo.md                |  1 +
 man/osmium-merge-changes.md           |  4 ++
 man/osmium-merge.md                   |  5 +++
 man/osmium-renumber.md                |  5 ++-
 man/osmium-show.md                    |  2 +
 man/osmium-sort.md                    |  7 ++-
 man/osmium-time-filter.md             | 11 +++--
 src/CMakeLists.txt                    | 42 +++++++++++++++++-
 src/command_apply_changes.cpp         |  4 +-
 src/command_extract.cpp               | 10 +++--
 src/command_extract.hpp               |  1 +
 src/command_fileinfo.cpp              | 17 ++++---
 src/command_renumber.cpp              |  2 +-
 src/extract/strategy_smart.cpp        |  6 ++-
 test/extract/CMakeLists.txt           |  6 +++
 test/extract/config.json              | 10 +++++
 test/fileinfo/CMakeLists.txt          | 11 ++++-
 test/renumber/CMakeLists.txt          |  4 +-
 test/renumber/input-norel.osm         | 18 ++++++++
 test/renumber/output-norel-change.osc | 19 ++++++++
 31 files changed, 329 insertions(+), 112 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3d5840..70ec763 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,27 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 ### Fixed
 
 
+## [1.7.1] - 2017-08-25
+
+### Added
+
+- Extended some man pages.
+
+### Changed
+
+- Allow any OSM file header option with `fileinfo -g`. There is no final
+  list of possible options, so any option should be allowed.
+- Needs libosmium 2.13.1.
+
+### Fixed
+
+- Specifying extracts in config files was broken. The `extract` command was
+  not reading config files correctly and all resulting OSM files were empty.
+  Specifying an extract on the command line using `--bbox` or `--polygon`
+  was still working.
+- Allow zero-length index files in renumber.
+
+
 ## [1.7.0] - 2017-08-15
 
 ### Added
@@ -314,7 +335,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 - Minor updates to documentation and build system
 
 
-[unreleased]: https://github.com/osmcode/osmium-tool/compare/v1.7.0...HEAD
+[unreleased]: https://github.com/osmcode/osmium-tool/compare/v1.7.1...HEAD
+[1.7.1]: https://github.com/osmcode/osmium-tool/compare/v1.7.0...v1.7.1
 [1.7.0]: https://github.com/osmcode/osmium-tool/compare/v1.6.1...v1.7.0
 [1.6.1]: https://github.com/osmcode/osmium-tool/compare/v1.6.0...v1.6.1
 [1.6.0]: https://github.com/osmcode/osmium-tool/compare/v1.5.1...v1.6.0
diff --git a/CMakeLists.txt b/CMakeLists.txt
index da425f4..c587d19 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ project(osmium)
 
 set(OSMIUM_VERSION_MAJOR 1)
 set(OSMIUM_VERSION_MINOR 7)
-set(OSMIUM_VERSION_PATCH 0)
+set(OSMIUM_VERSION_PATCH 1)
 
 set(OSMIUM_VERSION ${OSMIUM_VERSION_MAJOR}.${OSMIUM_VERSION_MINOR}.${OSMIUM_VERSION_PATCH})
 
@@ -44,7 +44,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 find_package(Boost 1.55.0 REQUIRED COMPONENTS program_options)
 include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
 
-find_package(Osmium 2.13.0 REQUIRED COMPONENTS io)
+find_package(Osmium 2.13.1 REQUIRED COMPONENTS io)
 include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS})
 
 
@@ -89,85 +89,6 @@ endif()
 
 #-----------------------------------------------------------------------------
 #
-#  Optional "man" target to generate man pages
-#
-#-----------------------------------------------------------------------------
-message(STATUS "Looking for pandoc")
-find_program(PANDOC pandoc)
-
-function(add_man_page _section _name)
-    file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/man/man${_section})
-    set(_output_file ${CMAKE_BINARY_DIR}/man/man${_section}/${_name}.${_section})
-    set(_source_file ${CMAKE_SOURCE_DIR}/man/${_name}.md)
-    set(_dest_file ${CMAKE_BINARY_DIR}/man-source/${_name}.md)
-    file(READ ${CMAKE_SOURCE_DIR}/man/common-options.md MAN_COMMON_OPTIONS)
-    file(READ ${CMAKE_SOURCE_DIR}/man/progress-options.md MAN_PROGRESS_OPTIONS)
-    file(READ ${CMAKE_SOURCE_DIR}/man/input-options.md MAN_INPUT_OPTIONS)
-    file(READ ${CMAKE_SOURCE_DIR}/man/output-options.md MAN_OUTPUT_OPTIONS)
-    file(READ ${CMAKE_SOURCE_DIR}/export-example-config/default-config.json EXPORT_DEFAULT_CONFIG)
-    configure_file(${_source_file} ${_dest_file} @ONLY)
-    string(TOUPPER ${_name} _name_upcase)
-    add_custom_command(OUTPUT ${_output_file}
-        COMMAND ${PANDOC}
-            ${PANDOC_MAN_OPTIONS}
-            --variable "title=${_name_upcase}"
-            --variable "section=${_section}"
-            -o ${_output_file}
-            ${_dest_file}
-        DEPENDS ${_source_file} man/manpage.template man/common-options.md man/input-options.md man/output-options.md
-        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-        COMMENT "Building manpage ${_name}.${_section}"
-        VERBATIM)
-    set(ALL_MAN_PAGES "${ALL_MAN_PAGES};${_output_file}" PARENT_SCOPE)
-endfunction()
-
-
-if(PANDOC)
-    message(STATUS "Looking for pandoc - found")
-    message(STATUS "  Manual pages will be built")
-    set(PANDOC_MAN_OPTIONS
-        -s
-        -t man
-        --template ${CMAKE_CURRENT_SOURCE_DIR}/man/manpage.template
-        --variable "description=osmium/${OSMIUM_VERSION}"
-        --variable "version=${OSMIUM_VERSION}"
-        --variable "author=${AUTHOR}"
-    )
-    set(PANDOC_HTML_OPTIONS -s -t html)
-
-    add_man_page(1 osmium)
-    add_man_page(1 osmium-add-locations-to-ways)
-    add_man_page(1 osmium-apply-changes)
-    add_man_page(1 osmium-cat)
-    add_man_page(1 osmium-changeset-filter)
-    add_man_page(1 osmium-check-refs)
-    add_man_page(1 osmium-derive-changes)
-    add_man_page(1 osmium-diff)
-    add_man_page(1 osmium-export)
-    add_man_page(1 osmium-extract)
-    add_man_page(1 osmium-fileinfo)
-    add_man_page(1 osmium-getid)
-    add_man_page(1 osmium-merge)
-    add_man_page(1 osmium-merge-changes)
-    add_man_page(1 osmium-renumber)
-    add_man_page(1 osmium-show)
-    add_man_page(1 osmium-sort)
-    add_man_page(1 osmium-tags-filter)
-    add_man_page(1 osmium-time-filter)
-    add_man_page(5 osmium-file-formats)
-    add_man_page(5 osmium-index-types)
-
-    install(DIRECTORY ${CMAKE_BINARY_DIR}/man DESTINATION share)
-
-    add_custom_target(man ALL DEPENDS ${ALL_MAN_PAGES})
-else()
-    message(STATUS "Looking for pandoc - not found")
-    message(STATUS "  Manual pages will not be built")
-endif()
-
-
-#-----------------------------------------------------------------------------
-#
 #  Decide which C++ version to use (Minimum/default: C++11).
 #
 #-----------------------------------------------------------------------------
@@ -289,6 +210,7 @@ add_subdirectory(test)
 
 #-----------------------------------------------------------------------------
 
+add_subdirectory(man)
 add_subdirectory(src)
 
 
diff --git a/README.md b/README.md
index 3fd7e49..e0ea12d 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ later are known to work. It also works on modern Visual Studio C++ compilers.
 
 You also need the following libraries:
 
-    Libosmium (>= 2.13.0)
+    Libosmium (>= 2.13.1)
         http://osmcode.org/libosmium
         Debian/Ubuntu: libosmium2-dev
 
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
new file mode 100644
index 0000000..7c42cc0
--- /dev/null
+++ b/man/CMakeLists.txt
@@ -0,0 +1,79 @@
+#-----------------------------------------------------------------------------
+#
+#  Optional "man" target to generate man pages
+#
+#-----------------------------------------------------------------------------
+message(STATUS "Looking for pandoc")
+find_program(PANDOC pandoc)
+
+function(add_man_page _section _name)
+    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man${_section})
+    set(_output_file ${CMAKE_CURRENT_BINARY_DIR}/man${_section}/${_name}.${_section})
+    set(_source_file ${CMAKE_CURRENT_SOURCE_DIR}/${_name}.md)
+    set(_dest_file ${CMAKE_BINARY_DIR}/man-source/${_name}.md)
+    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/common-options.md MAN_COMMON_OPTIONS)
+    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/progress-options.md MAN_PROGRESS_OPTIONS)
+    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/input-options.md MAN_INPUT_OPTIONS)
+    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/output-options.md MAN_OUTPUT_OPTIONS)
+    file(READ ${CMAKE_SOURCE_DIR}/export-example-config/default-config.json EXPORT_DEFAULT_CONFIG)
+    configure_file(${_source_file} ${_dest_file} @ONLY)
+    string(TOUPPER ${_name} _name_upcase)
+    add_custom_command(OUTPUT ${_output_file}
+        COMMAND ${PANDOC}
+            ${PANDOC_MAN_OPTIONS}
+            --variable "title=${_name_upcase}"
+            --variable "section=${_section}"
+            -o ${_output_file}
+            ${_dest_file}
+        DEPENDS ${_source_file} manpage.template common-options.md input-options.md output-options.md
+        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+        COMMENT "Building manpage ${_name}.${_section}"
+        VERBATIM)
+    set(ALL_MAN_PAGES "${ALL_MAN_PAGES};${_output_file}" PARENT_SCOPE)
+endfunction()
+
+
+if(PANDOC)
+    message(STATUS "Looking for pandoc - found")
+    message(STATUS "  Manual pages will be built")
+    set(PANDOC_MAN_OPTIONS
+        -s
+        -t man
+        --template ${CMAKE_CURRENT_SOURCE_DIR}/manpage.template
+        --variable "description=osmium/${OSMIUM_VERSION}"
+        --variable "version=${OSMIUM_VERSION}"
+        --variable "author=${AUTHOR}"
+    )
+    set(PANDOC_HTML_OPTIONS -s -t html)
+
+    add_man_page(1 osmium)
+    add_man_page(1 osmium-add-locations-to-ways)
+    add_man_page(1 osmium-apply-changes)
+    add_man_page(1 osmium-cat)
+    add_man_page(1 osmium-changeset-filter)
+    add_man_page(1 osmium-check-refs)
+    add_man_page(1 osmium-derive-changes)
+    add_man_page(1 osmium-diff)
+    add_man_page(1 osmium-export)
+    add_man_page(1 osmium-extract)
+    add_man_page(1 osmium-fileinfo)
+    add_man_page(1 osmium-getid)
+    add_man_page(1 osmium-merge)
+    add_man_page(1 osmium-merge-changes)
+    add_man_page(1 osmium-renumber)
+    add_man_page(1 osmium-show)
+    add_man_page(1 osmium-sort)
+    add_man_page(1 osmium-tags-filter)
+    add_man_page(1 osmium-time-filter)
+    add_man_page(5 osmium-file-formats)
+    add_man_page(5 osmium-index-types)
+
+    install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DESTINATION share)
+
+    add_custom_target(man ALL DEPENDS ${ALL_MAN_PAGES})
+else()
+    message(STATUS "Looking for pandoc - not found")
+    message(STATUS "  Manual pages will not be built")
+endif()
+
+
diff --git a/man/osmium-add-locations-to-ways.md b/man/osmium-add-locations-to-ways.md
index 576aedc..146e548 100644
--- a/man/osmium-add-locations-to-ways.md
+++ b/man/osmium-add-locations-to-ways.md
@@ -38,7 +38,11 @@ If the **--keep-untagged-nodes**, **-n** option is used, files created by this
 command can be updated with the **apply-changes** command using the
 **--locations-on-ways** option.
 
-This program will not work on full history files.
+This command will not work on full history files.
+
+This commands reads its input file(s) only once and writes its output file
+in one go so it can be streamed, ie. it can read from STDIN and write to
+STDOUT.
 
 
 # OPTIONS
diff --git a/man/osmium-apply-changes.md b/man/osmium-apply-changes.md
index 69e8156..a4a4063 100644
--- a/man/osmium-apply-changes.md
+++ b/man/osmium-apply-changes.md
@@ -23,6 +23,10 @@ Changes can be applied to normal OSM data files or OSM history files with this
 command. File formats will be autodetected from the file name suffixes, see
 the **--with-history** option if that doesn't work.
 
+This commands reads its input file(s) only once and writes its output file
+in one go so it can be streamed, ie. it can read from STDIN and write to
+STDOUT.
+
 
 # OPTIONS
 
diff --git a/man/osmium-cat.md b/man/osmium-cat.md
index fca08a5..f5dc7c4 100644
--- a/man/osmium-cat.md
+++ b/man/osmium-cat.md
@@ -17,6 +17,10 @@ is not sorted in any way but strictly copied from input to output.
 Because this program supports several different input and output formats, it
 can be used to convert OSM files from one format into another.
 
+This commands reads its input file(s) only once and writes its output file
+in one go so it can be streamed, ie. it can read from STDIN and write to
+STDOUT.
+
 
 # OPTIONS
 
diff --git a/man/osmium-changeset-filter.md b/man/osmium-changeset-filter.md
index a4dc226..1b02b5f 100644
--- a/man/osmium-changeset-filter.md
+++ b/man/osmium-changeset-filter.md
@@ -14,6 +14,10 @@ osmium-changeset-filter - filter changesets from OSM changeset file
 Copy the changesets matching all the given criteria to the output. Matching
 criteria are given through command line options.
 
+This commands reads its input file only once and writes its output file
+in one go so it can be streamed, ie. it can read from STDIN and write to
+STDOUT.
+
 # FILTER OPTIONS
 
 -a, --after=TIMESTAMP
diff --git a/man/osmium-check-refs.md b/man/osmium-check-refs.md
index 5fdab05..14f46d7 100644
--- a/man/osmium-check-refs.md
+++ b/man/osmium-check-refs.md
@@ -31,6 +31,7 @@ the **osmium-sort**(1) man page for details of the ordering.
 This command will only work for OSM data files, not OSM history files or
 change files.
 
+This commands reads its input file only once, ie. it can read from STDIN.
 
 # OPTIONS
 
diff --git a/man/osmium-derive-changes.md b/man/osmium-derive-changes.md
index 639e984..42be4d7 100644
--- a/man/osmium-derive-changes.md
+++ b/man/osmium-derive-changes.md
@@ -42,6 +42,10 @@ other information will be removed. But you can change this using the
 options. Depending on which software you are using the change files with,
 different settings might be necessary.
 
+This commands reads its input files only once and writes its output file
+in one go so it can be streamed, ie. it can read from STDIN and write to
+STDOUT.
+
 
 # OPTIONS
 
diff --git a/man/osmium-file-formats.md b/man/osmium-file-formats.md
index e85f675..b51d0b0 100644
--- a/man/osmium-file-formats.md
+++ b/man/osmium-file-formats.md
@@ -3,15 +3,48 @@
 
 osmium-file-formats - OSM file formats known to Osmium
 
+# FILE TYPES
+
+OSM uses three types of files for its main data:
+
+**Data files**
+:   These are the most common files containing the OSM data at a specific point
+    in time. This can either be a planet file containing *all* OSM data or some
+    kind of extract. At most one version of every object (node, way, or
+    relation) is contained in this file. Deleted objects are *not* in this
+    file. The usual suffix used is `.osm`.
+
+**History files**
+:   These files contain not only the current version of an object, but their
+    history, too. So for any object (node, way, or relation) there can be zero
+    or more versions in this file. Deleted objects can also be in this file.
+    The usual suffix used is `.osm` or `.osh`. Because sometimes the same
+    suffix is used as for normal data files (`.osm`) and because there is no
+    clear indicator in the header, it is not always clear what type of file
+    you have in front of you.
+
+**Change files**
+:   Sometimes called *diff files* or *replication diffs* these files
+    contain the changes between one state of the OSM database and another
+    state. Change files can contains several versions of an object.
+    The usual suffix used is `.osc`.
+
+All these files have in common that they contain OSM objects (nodes, ways, and
+relations). History files and change files can contain several versions of the
+same object and also deleted objects, data files can't.
+
+Where possible, Osmium commands can handle all file types. For some commands
+only some file types make sense.
+
 # FORMATS
 
-The **osmium** command line tool supports all file formats supported by the
-Osmium library. These are:
+The **osmium** command line tool supports all major OSM file formats plus
+some more. These are:
 
 * The classical XML format in the variants *.osm* (for data files),
   *.osh* (for data files with history) and *.osc* (for change files).
-* The PBF binary format (usually with suffix *.osm.pbf*).
-* The OPL format (usually with suffix *.osm.opl*).
+* The PBF binary format (usually with suffix *.osm.pbf* or just *.pbf*).
+* The OPL format (usually with suffix *.osm.opl* or just *.opl*).
 * The O5M/O5C format (usually with suffix *.o5m* or *.o5c*) (reading only).
 * The "debug" format (usually with suffix *.osm.debug*) (writing only).
 
@@ -73,6 +106,9 @@ Here are some examples:
 `osm.gz,xml_change_format=true`
 :   OSM change file, compressed with gzip.
 
+`osh.opl`
+:   OSM history file in OPL format.
+
 
 # SEE ALSO
 
diff --git a/man/osmium-fileinfo.md b/man/osmium-fileinfo.md
index 08b6f12..f619fce 100644
--- a/man/osmium-fileinfo.md
+++ b/man/osmium-fileinfo.md
@@ -48,6 +48,7 @@ Data
     the file (history files and change files can have that). See the
     **osmium-sort**(1) man page for details of the expected ordering.
 
+This commands reads its input file only once, ie. it can read from STDIN.
 
 # OPTIONS
 
diff --git a/man/osmium-merge-changes.md b/man/osmium-merge-changes.md
index 180573e..db4ed5f 100644
--- a/man/osmium-merge-changes.md
+++ b/man/osmium-merge-changes.md
@@ -16,6 +16,10 @@ change file. Objects are sorted by type, ID, version, and timestamp so it
 doesn't matter in what order the change files are given or in what order they
 contain the data.
 
+This commands reads its input file(s) only once and writes its output file
+in one go so it can be streamed, ie. it can read from STDIN and write to
+STDOUT.
+
 
 # OPTIONS
 
diff --git a/man/osmium-merge.md b/man/osmium-merge.md
index 3d7e655..ad83ab4 100644
--- a/man/osmium-merge.md
+++ b/man/osmium-merge.md
@@ -31,6 +31,11 @@ in correct OSM files, but sometimes buggy programs can generate data like this.
 Osmium doesn't make any promises on what the result of the command is if the
 input data is not correct.
 
+This commands reads its input file(s) only once and writes its output file
+in one go so it can be streamed, ie. it can read from STDIN and write to
+STDOUT.
+
+
 @MAN_COMMON_OPTIONS@
 @MAN_INPUT_OPTIONS@
 @MAN_OUTPUT_OPTIONS@
diff --git a/man/osmium-renumber.md b/man/osmium-renumber.md
index 4f9aa3d..f81cc28 100644
--- a/man/osmium-renumber.md
+++ b/man/osmium-renumber.md
@@ -23,7 +23,10 @@ nodes in order of ID, then ways in order of ID, then relations in order of ID.
 Negative IDs are allowed, they must be ordered before the positive IDs. See
 the **osmium-sort**(1) man page for details of the ordering.
 
-The input file will be read twice, so it will not work with STDIN.
+The input file will be read twice, so it will not work with STDIN. If you
+are not renumbering relations (ie. if the option **--object-type/-t** is used
+with nodes and/or ways but not relations) the input file will only be read
+once, so in that case it will work with STDIN.
 
 To renumber the IDs in several files, call **osmium renumber** for each file
 and specify the `-i` or `--index-directory` option each time. See the
diff --git a/man/osmium-show.md b/man/osmium-show.md
index e78193e..50742a4 100644
--- a/man/osmium-show.md
+++ b/man/osmium-show.md
@@ -21,6 +21,8 @@ variable. If neither is set, the default `less` is used unless the option
 `--no-pager` is used. If the pager variables are set to an empty value or
 to `cat`, no pager is used. On Windows there is no pager support at all.
 
+This commands reads its input file only once, ie. it can read from STDIN.
+
 
 # OPTIONS
 
diff --git a/man/osmium-sort.md b/man/osmium-sort.md
index d2aeebd..9439272 100644
--- a/man/osmium-sort.md
+++ b/man/osmium-sort.md
@@ -25,7 +25,12 @@ relation -1, relation -2, ..., relation 1, relation 2, ...
 If there are several objects of the same type and with the same ID they are
 ordered by ascending version.
 
-This works with normal OSM data files, history files, and change files.
+This command works with normal OSM data files, history files, and change files.
+
+This commands reads its input file(s) only once and writes its output file
+in one go so it can be streamed, ie. it can read from STDIN and write to
+STDOUT.
+
 
 @MAN_COMMON_OPTIONS@
 @MAN_INPUT_OPTIONS@
diff --git a/man/osmium-time-filter.md b/man/osmium-time-filter.md
index 8a89e4e..e0aa162 100644
--- a/man/osmium-time-filter.md
+++ b/man/osmium-time-filter.md
@@ -16,15 +16,20 @@ Copy all objects that were valid at the given *TIME* or in the time period
 between *FROM-TIME* (inclusive) and *TO-TIME* (not inclusive) from the input
 file into the output file.  If no time is given, the current time is used.
 
-Usually the *INPUT-FILE* will be an OSM data file with history. If both *FROM-TIME*
-and *TO-TIME* are given, the result will also have history data, it will also
-include deleted versions of objects.
+Usually the *INPUT-FILE* will be an OSM data file with history. If both
+*FROM-TIME* and *TO-TIME* are given, the result will also have history data,
+it will also include deleted versions of objects.
 
 If only a single point in time was given, the result will be a normal OSM file
 without history containing no deleted objects.
 
 The format for the timestamps is "yyyy-mm-ddThh:mm::ssZ".
 
+This commands reads its input file only once and writes its output file
+in one go so it can be streamed, ie. it can read from STDIN and write to
+STDOUT.
+
+
 @MAN_COMMON_OPTIONS@
 @MAN_INPUT_OPTIONS@
 @MAN_OUTPUT_OPTIONS@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 22c68b2..a088871 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,7 +6,47 @@
 #
 #-----------------------------------------------------------------------------
 
-file(GLOB OSMIUM_SOURCE_FILES *.cpp */*.cpp ${PROJECT_BINARY_DIR}/src/version.cpp)
+set(OSMIUM_SOURCE_FILES
+    ${PROJECT_BINARY_DIR}/src/version.cpp
+    cmd.cpp
+    cmd_factory.cpp
+    io.cpp
+    main.cpp
+    util.cpp
+    command_add_locations_to_ways.cpp
+    command_apply_changes.cpp
+    command_cat.cpp
+    command_changeset_filter.cpp
+    command_check_refs.cpp
+    command_derive_changes.cpp
+    command_diff.cpp
+    command_export.cpp
+    command_extract.cpp
+    command_fileinfo.cpp
+    command_getid.cpp
+    command_help.cpp
+    command_merge_changes.cpp
+    command_merge.cpp
+    command_renumber.cpp
+    commands.cpp
+    command_show.cpp
+    command_sort.cpp
+    command_tags_filter.cpp
+    command_time_filter.cpp
+    export/export_format_json.cpp
+    export/export_format_text.cpp
+    export/export_handler.cpp
+    extract/extract_bbox.cpp
+    extract/extract.cpp
+    extract/extract_polygon.cpp
+    extract/geojson_file_parser.cpp
+    extract/osm_file_parser.cpp
+    extract/poly_file_parser.cpp
+    extract/strategy_complete_ways.cpp
+    extract/strategy_complete_ways_with_history.cpp
+    extract/strategy_simple.cpp
+    extract/strategy_smart.cpp
+)
 
 add_executable(osmium ${OSMIUM_SOURCE_FILES})
 
diff --git a/src/command_apply_changes.cpp b/src/command_apply_changes.cpp
index 768d7d4..0aae2e5 100644
--- a/src/command_apply_changes.cpp
+++ b/src/command_apply_changes.cpp
@@ -233,7 +233,7 @@ bool CommandApplyChanges::run() {
         m_vout << "Sorting change data...\n";
         objects.sort(osmium::object_order_type_id_version());
 
-        auto input = osmium::io::make_input_iterator_range<osmium::OSMObject>(reader);
+        const auto input = osmium::io::make_input_iterator_range<osmium::OSMObject>(reader);
         auto out = osmium::io::make_output_iterator(writer);
         m_vout << "Applying changes and writing them to output...\n";
         std::set_union(objects.begin(),
@@ -325,7 +325,7 @@ bool CommandApplyChanges::run() {
             }
             progress_bar.done();
         } else {
-            auto input = osmium::io::make_input_iterator_range<osmium::OSMObject>(reader);
+            const auto input = osmium::io::make_input_iterator_range<osmium::OSMObject>(reader);
             auto output_it = boost::make_function_output_iterator(
                                 copy_first_with_id(writer)
             );
diff --git a/src/command_extract.cpp b/src/command_extract.cpp
index 40b17f2..46f6917 100644
--- a/src/command_extract.cpp
+++ b/src/command_extract.cpp
@@ -427,7 +427,7 @@ bool CommandExtract::setup(const std::vector<std::string>& arguments) {
     }
 
     if (vm.count("strategy")) {
-        m_strategy = make_strategy(vm["strategy"].as<std::string>());
+        m_strategy_name = vm["strategy"].as<std::string>();
     }
 
     return true;
@@ -438,9 +438,8 @@ void CommandExtract::show_arguments() {
     show_output_arguments(m_vout);
 
     m_vout << "  strategy options:\n";
-    m_vout << "    strategy: " << m_strategy->name() << '\n';
+    m_vout << "    strategy: " << m_strategy_name << '\n';
     m_vout << "    with history: " << yes_no(m_with_history);
-    m_strategy->show_arguments(m_vout);
 
     m_vout << "  other options:\n";
     m_vout << "    config file: " << m_config_file_name << '\n';
@@ -461,7 +460,7 @@ void CommandExtract::show_extracts() {
         m_vout << "     Format:      " << e->output_format()    << '\n';
         m_vout << "     Description: " << e->description()      << '\n';
         if (!e->header_options().empty()) {
-        m_vout << "     Header opts: ";
+            m_vout << "     Header opts: ";
             bool first = true;
             for (const auto& opt : e->header_options()) {
                 if (first) {
@@ -494,6 +493,9 @@ bool CommandExtract::run() {
 
     show_extracts();
 
+    m_strategy = make_strategy(m_strategy_name);
+    m_strategy->show_arguments(m_vout);
+
     osmium::io::Header header;
     setup_header(header);
 
diff --git a/src/command_extract.hpp b/src/command_extract.hpp
index 9de0346..7fdf605 100644
--- a/src/command_extract.hpp
+++ b/src/command_extract.hpp
@@ -43,6 +43,7 @@ class CommandExtract : public Command, public with_single_osm_input, public with
     std::string m_config_directory;
     std::string m_output_directory;
     osmium::util::Options m_options;
+    std::string m_strategy_name;
     std::unique_ptr<ExtractStrategy> m_strategy;
     std::vector<std::unique_ptr<Extract>> m_extracts;
     osmium::memory::Buffer m_buffer{initial_buffer_size, osmium::memory::Buffer::auto_grow::yes};
diff --git a/src/command_fileinfo.cpp b/src/command_fileinfo.cpp
index 7cbf691..acc2731 100644
--- a/src/command_fileinfo.cpp
+++ b/src/command_fileinfo.cpp
@@ -528,11 +528,12 @@ bool CommandFileinfo::setup(const std::vector<std::string>& arguments) {
         "file.size",
         "header.with_history",
         "header.option.generator",
-        "header.option.version",
-        "header.option.pbf_dense_nodes",
-        "header.option.osmosis_replication_timestamp",
-        "header.option.osmosis_replication_sequence_number",
         "header.option.osmosis_replication_base_url",
+        "header.option.osmosis_replication_sequence_number",
+        "header.option.osmosis_replication_timestamp",
+        "header.option.pbf_dense_nodes",
+        "header.option.timestamp",
+        "header.option.version",
         "data.bbox",
         "data.timestamp.first",
         "data.timestamp.last",
@@ -558,9 +559,11 @@ bool CommandFileinfo::setup(const std::vector<std::string>& arguments) {
 
     if (vm.count("get")) {
         m_get_value = vm["get"].as<std::string>();
-        const auto& f = std::find(known_values.cbegin(), known_values.cend(), m_get_value);
-        if (f == known_values.cend()) {
-            throw argument_error{std::string{"Unknown value for --get/-g option '"} + m_get_value + "'. Use --show-variables/-G to see list of known values."};
+        if (m_get_value.substr(0, 14) != "header.option.") {
+            const auto& f = std::find(known_values.cbegin(), known_values.cend(), m_get_value);
+            if (f == known_values.cend()) {
+                throw argument_error{std::string{"Unknown value for --get/-g option '"} + m_get_value + "'. Use --show-variables/-G to see list of known values."};
+            }
         }
         if (m_get_value.substr(0, 5) == "data." && ! m_extended) {
             throw argument_error{"You need to set --extended/-e for any 'data.*' variables to be available."};
diff --git a/src/command_renumber.cpp b/src/command_renumber.cpp
index 200d7d6..fba5042 100644
--- a/src/command_renumber.cpp
+++ b/src/command_renumber.cpp
@@ -213,7 +213,7 @@ std::string CommandRenumber::filename(const char* name) const {
 
 void CommandRenumber::read_index(osmium::item_type type) {
     const std::string f{filename(osmium::item_type_to_name(type))};
-    const int fd = ::open(f.c_str(), O_RDONLY);
+    const int fd = ::open(f.c_str(), O_RDWR);
     if (fd < 0) {
         // if the file is not there we don't have to read anything and can return
         if (errno == ENOENT) {
diff --git a/src/extract/strategy_smart.cpp b/src/extract/strategy_smart.cpp
index 6824806..0e3a892 100644
--- a/src/extract/strategy_smart.cpp
+++ b/src/extract/strategy_smart.cpp
@@ -94,14 +94,16 @@ namespace strategy_smart {
     }
 
     void Strategy::show_arguments(osmium::util::VerboseOutput& vout) {
+        vout << "Additional strategy options:\n";
         if (m_types.empty()) {
-            vout << "    types: any\n";
+            vout << "  types: any\n";
         } else {
-            vout << "    types:\n";
+            vout << "  types:\n";
             for (const auto& type : m_types) {
                 vout << "      " << type << '\n';
             }
         }
+        vout << '\n';
     }
 
     class Pass1 : public Pass<Strategy, Pass1> {
diff --git a/test/extract/CMakeLists.txt b/test/extract/CMakeLists.txt
index 8c550f6..b87d684 100644
--- a/test/extract/CMakeLists.txt
+++ b/test/extract/CMakeLists.txt
@@ -10,6 +10,10 @@ function(check_extract _name _input _output _opts)
     check_output(extract ${_name} "extract --generator=test -f osm extract/${_input} ${_opts} -b 0,0,1.5,10" "extract/${_output}")
 endfunction()
 
+function(check_extract_cfg _name _input _output _opts)
+    check_output(extract cfg_${_name} "extract --generator=test extract/${_input} ${_opts} -c ${CMAKE_CURRENT_SOURCE_DIR}/config.json" "extract/${_output}")
+endfunction()
+
 
 #-----------------------------------------------------------------------------
 
@@ -20,5 +24,7 @@ check_extract(smart_mp      input1.osm output-smart.osm "-s smart -S types=multi
 check_extract(smart_any     input1.osm output-smart.osm "-s smart -S types=any")
 check_extract(smart_nonmp   input1.osm output-smart-nonmp.osm "-s smart -S types=x")
 
+check_extract_cfg(simple    input1.osm output-simple.osm "-s simple")
+
 
 #-----------------------------------------------------------------------------
diff --git a/test/extract/config.json b/test/extract/config.json
new file mode 100644
index 0000000..f23c533
--- /dev/null
+++ b/test/extract/config.json
@@ -0,0 +1,10 @@
+{
+  "extracts": [
+    {
+      "output": "-",
+      "output_format": "osm",
+      "description": "Test",
+      "bbox": [0,0,1.5,10]
+    }
+  ]
+}
diff --git a/test/fileinfo/CMakeLists.txt b/test/fileinfo/CMakeLists.txt
index 4698a10..fe43626 100644
--- a/test/fileinfo/CMakeLists.txt
+++ b/test/fileinfo/CMakeLists.txt
@@ -12,7 +12,16 @@ endfunction()
 
 #-----------------------------------------------------------------------------
 
-check_fileinfo(fi1 "--extended" fi1.osm fi1-result.txt)
+check_fileinfo(fi1-extended "--extended" fi1.osm fi1-result.txt)
+
+add_test(NAME fileinfo-g-generator COMMAND osmium fileinfo ${CMAKE_SOURCE_DIR}/test/fileinfo/fi1.osm -g header.option.generator)
+set_tests_properties(fileinfo-g-generator PROPERTIES PASS_REGULAR_EXPRESSION "^testdata\n$")
+
+add_test(NAME fileinfo-g-unknown-option COMMAND osmium fileinfo ${CMAKE_SOURCE_DIR}/test/fileinfo/fi1.osm -g header.option.foo)
+set_tests_properties(fileinfo-g-unknown-option PROPERTIES PASS_REGULAR_EXPRESSION "^$")
+
+add_test(NAME fileinfo-g-fail COMMAND osmium fileinfo ${CMAKE_SOURCE_DIR}/test/fileinfo/fi1.osm -g foobar)
+set_tests_properties(fileinfo-g-fail PROPERTIES WILL_FAIL true)
 
 
 #-----------------------------------------------------------------------------
diff --git a/test/renumber/CMakeLists.txt b/test/renumber/CMakeLists.txt
index 4285155..f568e79 100644
--- a/test/renumber/CMakeLists.txt
+++ b/test/renumber/CMakeLists.txt
@@ -15,7 +15,7 @@ function(check_renumber_nodes _name _input _output)
 endfunction()
 
 function(check_renumber2 _name _in1 _in2 _out)
-    set(_idxdir "${PROJECT_BINARY_DIR}/test/renumber/index")
+    set(_idxdir "${PROJECT_BINARY_DIR}/test/renumber/index/${_name}")
     if(WIN32)
         set(_devnull "nul")
     else()
@@ -33,6 +33,8 @@ check_renumber_nodes(nodes-sorted input-sorted.osm output-sorted-n.osm)
 
 check_renumber2(change input-sorted.osm input-change.osc output-change.osc)
 
+check_renumber2(change-norel input-norel.osm input-change.osc output-norel-change.osc)
+
 #-----------------------------------------------------------------------------
 
 # input data not ordered properly
diff --git a/test/renumber/input-norel.osm b/test/renumber/input-norel.osm
new file mode 100644
index 0000000..8c7f34c
--- /dev/null
+++ b/test/renumber/input-norel.osm
@@ -0,0 +1,18 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version="0.6" upload="false" generator="testdata">
+  <node id="-11" version="1" timestamp="2015-01-01T01:00:00Z" uid="1" user="test" changeset="1" lat="1" lon="1"/>
+  <node id="11" version="1" timestamp="2015-01-01T01:00:00Z" uid="1" user="test" changeset="1" lat="2" lon="1"/>
+  <node id="12" version="1" timestamp="2015-01-01T01:00:00Z" uid="1" user="test" changeset="1" lat="3" lon="1"/>
+  <node id="14" version="1" timestamp="2015-01-01T01:00:00Z" uid="1" user="test" changeset="1" lat="4" lon="1"/>
+  <way id="20" version="1" timestamp="2015-01-01T01:00:00Z" uid="1" user="test" changeset="1">
+    <nd ref="-11"/>
+    <nd ref="11"/>
+    <nd ref="12"/>
+    <tag k="foo" v="bar"/>
+  </way>
+  <way id="21" version="1" timestamp="2015-01-01T01:00:00Z" uid="1" user="test" changeset="1">
+    <nd ref="12"/>
+    <nd ref="14"/>
+    <tag k="xyz" v="abc"/>
+  </way>
+</osm>
diff --git a/test/renumber/output-norel-change.osc b/test/renumber/output-norel-change.osc
new file mode 100644
index 0000000..5767d0b
--- /dev/null
+++ b/test/renumber/output-norel-change.osc
@@ -0,0 +1,19 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osmChange version="0.6" generator="test">
+  <modify>
+    <node id="2" version="2" timestamp="2015-01-01T01:00:00Z" uid="1" user="test" changeset="2" lat="2" lon="2"/>
+  </modify>
+  <delete>
+    <node id="4" version="2" timestamp="2015-01-01T01:00:00Z" uid="1" user="test" changeset="2" lat="4" lon="1"/>
+  </delete>
+  <create>
+    <node id="5" version="1" timestamp="2015-01-01T01:00:00Z" uid="1" user="test" changeset="2" lat="2" lon="2"/>
+  </create>
+  <modify>
+    <way id="2" version="2" timestamp="2015-01-01T01:00:00Z" uid="1" user="test" changeset="2">
+      <nd ref="3"/>
+      <nd ref="5"/>
+      <tag k="xyz" v="new"/>
+    </way>
+  </modify>
+</osmChange>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osmium-tool.git



More information about the Pkg-grass-devel mailing list