Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce iterative processing #245

Merged
merged 4 commits into from
Mar 17, 2024
Merged

Conversation

lonvia
Copy link
Member

@lonvia lonvia commented Mar 16, 2024

Introduces a new class FileProcessor, which can be used to read a file iteratively:

for obj in osmium.FileProcessor('foo.osm.xml'):
    if obj.is_node():
        print(f'Found node {obj.id}')

Location handling, area processing and the new filter classes can be used with the processor. The same scope restrictions apply as for handlers: an object can only be accessed inside the loop. If you need to keep data, you need to copy it out.

There is no documentation yet. Refer to the refurbished examples and new tests for an idea how this is supposed to work. This is still a bit experimental and the interface might still slightly change.

@lonvia lonvia merged commit e3038c3 into osmcode:master Mar 17, 2024
20 checks passed
@lonvia lonvia deleted the file-processor branch March 17, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant