Skip to content

Commit

Permalink
Propagate timestamp (int) to Python
Browse files Browse the repository at this point in the history
  • Loading branch information
Famlam authored and frodrigo committed Aug 20, 2024
1 parent a59085a commit b91be53
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions modules/OsmPbf_libosmbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,35 +85,35 @@ def CopyTo(self, output):
osm_pbf_parser.read_osm_pbf(self._pbf_file, self)


def node(self, osmid, lon, lat, tags):
def node(self, osmid, lon, lat, tags, timestamp):
data = {
'id': osmid,
'lon': lon,
'lat': lat,
'tag': tags,
#'version'
#'timestamp'
'timestamp': timestamp,
#'uid'
}
self._output.NodeCreate(data)

def way(self, osmid, tags, refs):
def way(self, osmid, tags, refs, timestamp):
data = {
'id': osmid,
'tag': tags,
'nd': refs,
#'version'
#'timestamp'
'timestamp': timestamp,
#'uid'
}
self._output.WayCreate(data)

def relation(self, osmid, tags, ref):
def relation(self, osmid, tags, ref, timestamp):
data = {
'id': osmid,
'tag': tags,
#'version'
#'timestamp'
'timestamp': timestamp,
#'uid'
'member': ref,
}
Expand Down
6 changes: 3 additions & 3 deletions modules/osm_pbf_parser/osm_pbf_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct Visitor

void node_callback(uint64_t osmid, double lon, double lat, const Tags & tags, const uint64_t timestamp) {
if (!tags.empty() && (since_timestamp == 0 || timestamp == 0 || timestamp >= since_timestamp)) {
call_method<void>(self, "node", osmid, lon, lat, tagsToDict(tags));
call_method<void>(self, "node", osmid, lon, lat, tagsToDict(tags), timestamp);
} else {
filtered_nodes_osmid.push_back(osmid);
}
Expand All @@ -92,7 +92,7 @@ struct Visitor

void way_callback(uint64_t osmid, const Tags & tags, const std::vector<uint64_t> & refs, const uint64_t timestamp) {
if (since_timestamp == 0 || timestamp == 0 || timestamp >= since_timestamp) {
call_method<void>(self, "way", osmid, tagsToDict(tags), nodeIdToList(refs));
call_method<void>(self, "way", osmid, tagsToDict(tags), nodeIdToList(refs), timestamp);
} else {
filtered_ways_osmid.push_back(osmid);
}
Expand All @@ -104,7 +104,7 @@ struct Visitor

void relation_callback(uint64_t osmid, const Tags & tags, const References & refs, const uint64_t timestamp) {
if (since_timestamp == 0 || timestamp == 0 || timestamp >= since_timestamp) {
call_method<void>(self, "relation", osmid, tagsToDict(tags), referencesToDict(refs));
call_method<void>(self, "relation", osmid, tagsToDict(tags), referencesToDict(refs), timestamp);
} else {
filtered_relations_osmid.push_back(osmid);
}
Expand Down

0 comments on commit b91be53

Please sign in to comment.