Skip to content

Latest commit

 

History

History
 
 

replication

osm/replication Godoc Reference

Package replication handles fetching the Minute, Hour, Day and Changeset replication and the associated state value from Planet OSM.

For example, to fetch the current Minute replication state:

num, fullState, err := replication.CurrentMinuteState(ctx)

This is the data in http://planet.osm.org/replication/minute/state.txt updated every minute.

Once you know the change number you want, fetch the change using:

change, err := replication.Minute(ctx, num)

Finding sequences numbers by timestamp

It's also possible to find the sequence number by timestamp. These calls make multiple requests for state to find the one matching the given timestamp.

MinuteStateAt(ctx context.Context, timestamp time.Time) (MinuteSeqNum, *State, error)
HourStateAt(ctx context.Context, timestamp time.Time) (HourSeqNum, *State, error)
DayStateAt(ctx context.Context, timestamp time.Time) (DaySeqNum, *State, error)
ChangesetStateAt(ctx context.Context, timestamp time.Time) (ChangesetSeqNum, *State, error)