<div dir="ltr">Ah, good idea! My backup plan was to create a fake OSM changeset file to apply to PBF tiles to tag every way I wanted to remove with a "deleted=yes" tag or somesuch, so that I could then filter them with "osmium tags-filter". Your way seems simpler :)<div><br></div><div>It's amazing how long you can use unixy systems and still discover new tools...I hadn't heard of 'comm' before.</div><div><br></div><div>Thanks,</div><div>Craig</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 11, 2021 at 11:49 AM Jochen Topf <<a href="mailto:jochen@remote.org">jochen@remote.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br>
<br>
there is a command to do the opposite of what you ask for: getid. With<br>
"osmium getid" you can get all the objects with the specified ids from<br>
the input file. That's simple and very fast and it can read lists of<br>
ids from a file. But it will not remove the objects with the ids you<br>
list but keep those.<br>
<br>
Because the lists of ids to remove is the "inverse" of the list to keep,<br>
it is reasonably straightforward to create one from the other using your<br>
preferred tools. You can use the "comm" command line tool for this. All<br>
you need for this is a list of all ids in the file which you can get<br>
with something like "osmium cat FILE.osm.pbf -f opl | cut -d' ' -f1".<br>
Or maybe your pyosmium program can just create the right list for<br>
"osmium getid" in the first place.<br>
<br>
Jochen<br>
<br>
On Thu, Mar 11, 2021 at 09:38:04AM -0500, Craig Durkin wrote:<br>
> Date: Thu, 11 Mar 2021 09:38:04 -0500<br>
> From: Craig Durkin <<a href="mailto:craigdurkin@gmail.com" target="_blank">craigdurkin@gmail.com</a>><br>
> To: <a href="mailto:dev@openstreetmap.org" target="_blank">dev@openstreetmap.org</a><br>
> Subject: [OSM-dev] Quick way to remove specific nodes/ways/relations with<br>
> osmium?<br>
> <br>
> Hi OSM folks -- I'm a regular user of Osmium for doing some filtering of<br>
> bicycle-accessible ways in OSM as part of an app I'm making. There are<br>
> plenty of tags (bicycle=no, bicycle=sidepath, etc.) that I can successfully<br>
> filter with "osmium tags-filter", but is there a similar way to filter by<br>
> OSM ID?<br>
> <br>
> There are specific ways that are correctly tagged on OSM as being bicycle<br>
> accessible, but my users would like them removed from the app for various<br>
> reasons, so changing the tagging on OSM would not be the right way to<br>
> achieve this.<br>
> <br>
> I have created a basic solution with pyosmium that reads a file and then<br>
> writes only those nodes/ways/relations that aren't in a 'forbidden' list,<br>
> but it is quite slow compared to native osmium commands, especially with<br>
> country-sized extracts.<br>
> <br>
> Is there a way to do something like "osmium id-filter w12134567", or should<br>
> I just upgrade my tool to C and use libosmium instead?<br>
> <br>
> Thanks,<br>
> Craig<br>
<br>
> _______________________________________________<br>
> dev mailing list<br>
> <a href="mailto:dev@openstreetmap.org" target="_blank">dev@openstreetmap.org</a><br>
> <a href="https://lists.openstreetmap.org/listinfo/dev" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/dev</a><br>
<br>
<br>
-- <br>
Jochen Topf <a href="mailto:jochen@remote.org" target="_blank">jochen@remote.org</a> <a href="https://www.jochentopf.com/" rel="noreferrer" target="_blank">https://www.jochentopf.com/</a> +49-351-31778688<br>
</blockquote></div>