I would like to automate a simple operation in the QGIS graphical modeler or a simple Python script.
- add all line features from a .pbf file
- filter all features with certain values within a certain field (e.g. "waterway" = 'canal')
Doing this manually is fairly easy, by just dragging the file in the canvas, selecting all line features, and then right clicking it to select filter.
However, in the graphical modeller I struggle with the very first step of loading the .pbf files' lines.
QuickOSM I know there is QuickOSM, but again I can do it manually, but the algorithm "Open sublayers from an OSM file" that you can add to the graphical modeler doesn't do the job. First you cannot distinguish between lines and other features types (as in the manual tool). And then, I can link it to some filter algorithms in the graphical modeler (eg. "Filter by geometry type", "Extract by attribute", or "extract by expresion"), but the best I get is an empty line feature :-(.
It seems that it is possible filtering the pbf file while loading it by configuring the .ini file (https://gdal.org/drivers/vector/osm.html). Thereby, I hope to obtain only one line feature output that I can use as input for follow up algorithms, but no idea how to do it.
esy-osmfilter Besides, esy-osmfilter is an easy Python solution, but it runs into memory crash for large data extracts.