You are not logged in.

#1 2021-04-21 07:33:49

mpele
Member
Registered: 2012-02-25
Posts: 263

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

--drop-relations="@id=123456"

, but

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

doesn't work sad

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

Offline

#2 2021-04-21 11:52:05

GerdP
Member
Registered: 2015-12-18
Posts: 1,463

Re: Modifying way/relation with known id in pbf

Did you try

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

?

Offline

#3 2021-04-21 17:49:40

SomeoneElse
Member
Registered: 2010-10-13
Posts: 1,483

Re: Modifying way/relation with known id in pbf

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.

Offline

#4 2021-04-21 21:33:11

mpele
Member
Registered: 2012-02-25
Posts: 263

Re: Modifying way/relation with known id in pbf

GerdP wrote:

Did you try

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

?

Yes, but it doesn't work. If there is "and" it looks like that the id clause is ignored sad

SomeoneElse wrote:

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.

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 ?!?

Offline

#5 2021-04-21 21:41:32

SomeoneElse
Member
Registered: 2010-10-13
Posts: 1,483

Re: Modifying way/relation with known id in pbf

I've used "osmosis" for that sort of thing - here's an example:

https://github.com/SomeoneElseOSM/Someo … er.sh#L190 is an example of a transformation of "name:cy" to "name", using rules in https://github.com/SomeoneElseOSM/Someo … orm_cy.xml .  I'm sure you could do something similar with admin levels.

The line above in the script, https://github.com/SomeoneElseOSM/Someo … er.sh#L188 , extracts a small area of PBF to perform the transformation on and a line further down merges everything together: https://github.com/SomeoneElseOSM/Someo … er.sh#L206 .

Last edited by SomeoneElse (2021-04-21 21:42:01)

Offline

#6 2021-04-22 21:16:23

mpele
Member
Registered: 2012-02-25
Posts: 263

Re: Modifying way/relation with known id in pbf

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

Offline

Board footer

Powered by FluxBB