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

provide info metadata to Nodes, Ways and Relations #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

erictapen
Copy link

Thanks for creating this library, I'm using it for a while now.

I needed this patch to process OSM history dumps, like the ones found at https://planet.openstreetmap.org/pbf/full-history/.

I was able to parse some 400MB large extracts using my patch without a problem.

This adds chrono as a dependency, as I felt that would be the best way to represent the timestamp.

Copy link
Owner

@TeXitoi TeXitoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Cargo.toml Outdated Show resolved Hide resolved
src/objects.rs Outdated
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Serialize, Deserialize)]
pub struct Info {
/// The timestamp when the object was introduced.
pub timestamp: Option<NaiveDateTime>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried by this:

  • there is 2 options inside each ones, that makes it difficult to use
  • the is_visible is obviously true if there is no info
  • all this option thing will use a non negligible amount of memory.

I don't have yet any solution to all of this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh yeah I'm not happy with the double Option either.

I think it makes sense to keep the Info object, as the osm protobuf definition provides some more fields like changeset and uid, so one might want to extend it in the future.

Not sure wether one could find an Info without a timestamp in the wild. I certainly didn't find one. Maybe it would make sense to make the timestamp non-optional?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, forgot about this PR.

Yeah, I think we can:

  • make timestamp non optional, outputing 0 in the rare case when we have no info
  • Option<NonZeroI64>, with some appropriate getters for ease of use. A timestamp of 0 is impossible as OSM didn't exist in 1970.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My OSM related project is on ice, so I won't be able to help further with this PR, sorry. Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants