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

no official equivalent of --id available when using ogr2osm as a library #23

Closed
pnoll1 opened this issue Oct 17, 2022 · 4 comments
Closed
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@pnoll1
Copy link

pnoll1 commented Oct 17, 2022

When switching from cli to library usage, I noticed there's no equivalent of the --id option mentioned in the example code. I managed to get the same behavior using

ogr2osm.osm_geometries.OsmId.set_id(id) 

before defining the data source. You may want to add this or a cleaner version to the example

@roelderickx
Copy link
Owner

Thanks for your report.

I've overlooked the combination of setting an id and the use of ogr2osm as a library, but that's of course a legit use. What you did is the only way for now but I agree it doesn't feel as the most elegant solution.

I think it would be more appropriate to set the start id in the instance of the OsmData class. I'll add it in the course of this week to the github repository.

@roelderickx
Copy link
Owner

The OsmData constructor has two new optional parameters now: start_id and is_positive. Only start_id is documented, is_positive is the equivalent of the equally undocumented --positive-id parameter.

@roelderickx roelderickx added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 21, 2022
@pnoll1
Copy link
Author

pnoll1 commented Oct 22, 2022

Looks good to me

@roelderickx
Copy link
Owner

roelderickx commented Oct 23, 2022

I added two more functions load_start_id_from_file and save_current_id_to_file to OsmData implementing the --idfile and --saveid parameters, to avoid the use of the OsmId class in client applications.
New testcases are added and all tests pass, merging into main and closing this issue. A new package release will follow shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants