Modifying way/relation with known id in pbf

Is it possible to use osmfilter to modify way/relation with known id?
I have downloaded pbf file from Geofabrik, and now, in order to be rendered correctly, I have to change tag value of admin_level for some relations.

I am able to drop it by using switch


, but

--modify-relation-tags="@id=123456 to admin=4"

doesn’t work :frowning:

Or, is there any other tool that could do this task?

Did you try

--modify-relation-tags="@id=123456 admin_level=2 to =4"


You say “in order to be rendered correctly”, which might mean you’re using a postgres database for rendering? If you are, you could just change it in there.

Yes, but it doesn’t work. If there is “and” it looks like that the id clause is ignored :frowning:

For tile server we use postgres and that data are modified directly in database, but that is not the only use of this data. I got the task to prepare pbf with modified data, it is not possible postgres → pbf so I have to do it directly in pbf.

Do you have any idea how it could be done? Maybe to extract elements with osmfilter, modify all extracted elements and than to merge it back into the main pbf ?!?

I’ve used “osmosis” for that sort of thing - here’s an example: is an example of a transformation of “name:cy” to “name”, using rules in . I’m sure you could do something similar with admin levels.

The line above in the script, , extracts a small area of PBF to perform the transformation on and a line further down merges everything together: .

SomeoneElse, Thank you for the idea and for your experience…