Closed arnesetzer closed 1 week ago
Do we maybe want to make this a command-line flag?
Not sure if this config can be generalized or whether it varies depending on individual needs 🤔
Sounds like a good idea. I'm on it.
Ready for review
Agh sorry I wasn't very clear. In the current version of this PR there is a boolean flag which controls whether the basic tag list is used or an extended tag list including path is used.
I feel like this approach isn't super flexible because users are still restricted to one or the other, and adding more options in the future would become difficult.
What I was proposing was a flag where you can provide an arbitrary list of highway tags:
pbf command --highway-tags="motorway,track"
This would allow full flexibility to the user on which tags they use, and they can be different from other users.
In the case where the flag hasn't been specified then the default tag list will be used (same as currently in master
)
If I recall correctly the highway tags are used in more than one command, so it would be nice if the flag was available for all those commands.
Added the option --highway-tags
for the streets
and xroads
command.
Ready for review @missinglink
@missinglink Ready for review
@missinglink Still ready for review 🙈 😄
OK so I would propose this: https://github.com/missinglink/pbf/compare/pr33?expand=1
It requires specifying multiple flags on the CLI as so:
go run pbf.go xroads /data/osm/new-zealand-latest.osm.pbf
[motorway primary residential road secondary service tertiary trunk]
go run pbf.go xroads --highway-tags 'foo' --highway-tags 'bar' /data/osm/new-zealand-latest.osm.pbf
[foo bar]
Use of the Value
prop allows the default values to be shown in the help dialog:
go run pbf.go streets --help
NAME:
pbf streets - export street segments as merged linestrings, encoded in various formats
USAGE:
pbf streets [command options] [arguments...]
OPTIONS:
--format value, -f value select output format, one of polyline/geojson/wkt
--delim value, -d value change the column delimiter (default )
--extended, -e output additional columns containing centroid and distance values
--highway-tags value custom highway tags (default: "motorway", "primary", "residential", "road", "secondary", "service", "tertiary", "trunk")
If you'd prefer to have it so the flag is specified once (with the strings delimited by a comma) then we can change to that, it's up to you, which you think is 'nicer'?
ie. --highway-tags='foo,bar'
vs. --highway-tags=foo --highway-tags=bar
ref: https://cli.urfave.org/v2/examples/flags/#multiple-values-per-single-flag
Now both commands use the StringSliceFlag
. Also implemented the use of the value variable for the default behavior.
After running go run pbf.go streets --highway-tags tertiary --highway-tags primary berlin-latest.osm.pbf > twoTags.txt
and go run pbf.go streets --highway-tags tertiary,primary berlin-latest.osm.pbf > oneTag.txt
diff/git diff and the vsc diff viewer tells me that the files are the same. So both approaches can be used, but I personally prefer the one tag version, since go run pbf.go streets --highway-tags motorway --highway-tags secondard --highway-tags tertiary --highway-tags primary --highway-tags trunk --highway-tags residential berlin-latest.osm.pbf > twoTags.txt
becomes quite long.
Hope I didn't miss anything 😄
Basically a copy of #19 since this was abandoned.
I added the tag
path
since "streets" like https://www.openstreetmap.org/way/5215288 or https://www.openstreetmap.org/way/319837352. I'm not quite sure about this tag, because it cause a lot of noise by external bicycle lanes, etc. Overpass query for example in munich: https://overpass-turbo.eu/s/1rJ0