Osmium merge - is there a way to make one file take precedence?

It’s not that unusual when preprocessing files that an input file is split, has various things done to it, and then the results are merged again. As an example, this script splits a larger area (Great Britain) into ones that are somewhat Welsh, Scots Gaelic and English, does various language transformations, and then merges them together. Problems can occur when the same object appears in more than one area if one of the names is “more correct” for the object than the other.

For example the relation for the island of Great Britain obviously appears in all three. When merged together “osmium merge” makes no promises about which version will appear in the output file, and currently Scots Gaelic seems to win out, despite the English file being the larger of the merged files; the resulting label appears in the West Midlands of England (not a noted Gaelic-speaking area).

Is there a way to better control what happens when there are duplicates in “osmium merge” input files, or perhaps eliminate duplicates in the first place?

No.

I suggest using PyOsmium, there you can write your own logic that decides what to do with the data if there is conflicting information in the input files.