[OSM-dev] Timestamp in PBF files

Jochen Topf jochen at remote.org
Tue Nov 20 19:09:05 GMT 2012


On Tue, Nov 20, 2012 at 06:57:50PM +0100, Stephan Knauss wrote:
> Frederik Ramm writes:
> 
> >I really don't mind *how* it's done but I would really love to
> >have one agreed way to place a timestamp in a PBF instead of
> >everyone rolling their own.
> 
> I would prefer epoch timestamps. That's a widely accepted way of
> storing time information without the need to worry about time zones
> and such.

The other timestamps in PBF files (at all the objects) use 64 bit integers with
seconds since epoch. So it would make sense to use the same format.

> While we change the header: Could we also include a field to
> indicate a full history planet? After the redaction period the

This already exists. You should add a "Required Feature" called
"HistoricalInformation".

> lat/lon is only a required field for non-redacted elements.
> Is it possible to express this in protobuf?

You can have optional fields in protobuf, but unfortunately this doesn't
help us in this case. There are two ways nodes can be stored in PBF files:
as a series of "Node" objects or as "DenseNode" objects. "Node" objects
have required fields "lat" and "lon". We could change this to be optional.
There would be a has_lat() or has_lon() call to check for this.

Unfortunately in most cases the more space efficient "DenseNode" objects are
used. In this case the latitude and longitude of all nodes of a block are
stored in a special delta encoding. This doesn't allow for optional fields.
As far as I can see we could either add a boolean for each node in a block that
defines whether the coordinate field is valid or use a special value for an
invalid coordinate.

> If not, it would be fine to have at least a defined value for
> "undefined" we could document. If I remember correctly Jochen
> suggested to use MAXINT for this.

I didn't suggest this. I merely noted that this is what happens in PBF files
generated by Osmium as a side-effect of the format used for undefined
coordinates internally in Osmium. As far as I know Osmium is the only software
currently used to create PBF files with history, so that set a precedent here.

Jochen
-- 
Jochen Topf  jochen at remote.org  http://www.remote.org/jochen/  +49-721-388298



More information about the dev mailing list