osmcode / osmium-tool

Command line tool for working with OpenStreetMap data based on the Osmium library.
https://osmcode.org/osmium-tool/
GNU General Public License v3.0
483 stars 104 forks source link

--attributes option is not supported on homebrew-installed osmium-tool #227

Closed iandees closed 2 years ago

iandees commented 2 years ago

I'm trying to run an osmium export with the @type and @id properties added to the output. The documentation says to specify this via a config file that you then specify via a command line argument. To simplify my script, I asked on the OSM US Slack if there was a way to specify those attributes on the CLI directly instead of setting up a config file. @mmd-osm said to use --attributes and gave several examples of it working on their machine with Osmium 1.13.1. This flag isn't in the documentation and doesn't work for me:

$ osmium export --attributes
Error parsing command line: unrecognised option '--attributes'
$ osmium export --attributes type,id
Error parsing command line: unrecognised option '--attributes'
$ osmium export --attributes=type,id
Error parsing command line: unrecognised option '--attributes=type,id'

On my Mac with osmium-tool installed via brew install osmium-tool, I get v1.13.1:

$ osmium version
osmium version 1.13.1
libosmium version 2.16.0
Supported PBF compression types: none zlib

Copyright (C) 2013-2021  Jochen Topf <jochen@topf.org>
License: GNU GENERAL PUBLIC LICENSE Version 3 <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

What am I missing?

mmd-osm commented 2 years ago

According to osmium help export:

   Another  option  is  to specify attributes list in a comma-separated string for the --attributes/-a command-line op‐
   tion.  This way you cannot control column names, but also you won’t have to create a config file.

As mentioned by @iandees , this worked fine for me on Ubuntu 20.04 using osmium tool 1.13.1, but for some reason it didn't work on macos.

joto commented 2 years ago

The option --attributes is not yet in a released version, only in master. Everybody reporting this as working in 1.13.1 probably has compiled the master version which will report something like osmium version 1.13.1 (v1.13.1-14-ga3516c1-changed) so you might easily think you are on 1.13.1 but you aren't.

mmd-osm commented 2 years ago

Ah that makes sense. I see now that attributes was only added in 5f8c8d6dfe5b278ffd45c46a4dd9d460d364d0ab , and 1.13.1 was released a few weeks earlier.