Documentation → How-to guides
Build a timeline
A timeline is a dataset in which each feature has the year it was built and, optionally, the year it was retired. A time slider moves the map through the years: each feature appears in the year it was built and disappears in the year it was retired. Timelines suit a network that grows over time, such as stations, cables, sites or permits, where new features are added rather than existing ones moved.
How a timeline is modelled
Each feature has a single geometry that doesn't change, and two number fields:
- Built year: the year the feature goes live (for example,
2028). - Decommissioned: the year it is retired. Leave this empty if the feature is still live.
At year Y, the map shows a feature if it was built in or before Y and hasn't yet been decommissioned. To show a network growing, add new features with later built years instead of reshaping existing ones. A feature with no built year is a baseline and appears at every year. Years are whole numbers; timelines don't record months or days.
A timeline is a normal dataset. It sits alongside your uploads, and you can style it, add it to any map and use it as an input to a SQL model. The two year fields and the slider are what make it a timeline. It is stored, shared and queried in the same way as any other dataset.
Create one from scratch
If you are creating the features yourself, draw the timeline on a map.
- Open a map in the editor and choose Draw features to start editing.
- Choose New Timeline (the clock icon below New Layer). An empty timeline is added to the map and opened for drawing.
- A year slider appears at the bottom of the map. Set it to the year of the features you are about to draw. While a timeline is open the slider reads New at year, because each feature you draw gets that year as its built year.
- Draw your features. To add features for later years, move the slider forward and carry on drawing. Each feature keeps the year that was set when you drew it.
- Choose Save. The timeline is tiled in place, and you can then use the slider to step through what you've built.
The slider year only sets the built year for new features. It doesn't change features you have already placed. To change a feature's year later, edit the feature (see below).
Fork one from an existing dataset
If you already have the geometry, such as a layer of sites with a column for the year each was built, you can turn it into an editable timeline instead of drawing it again.
- Open the dataset and choose Fork as Timeline.
- Choose how each feature gets its built year:
- From a field: use an existing numeric column that holds a year as the built year.
- One year for all features: give every feature in the dataset the same built year.
- No build year: every feature starts as a baseline, and you set the years yourself in the editor.
- Choose Fork as Timeline. mapbench creates a new, editable timeline and starts tiling it. The original dataset isn't changed.
You can only fork small datasets. Forking copies the features so you can edit them, so the source can have at most 2000 features and be at most 2 MiB. Larger layers should stay as full datasets rather than hand-edited timelines, and mapbench refuses the fork with a message saying so. A forked timeline is a derived dataset, so it automatically carries the source's attribution and licence obligations.
Edit the years on a feature
Select a feature while editing. The two timeline fields appear above its other attributes:
- Built year: type a year, or leave it blank to make the feature a baseline (the empty field shows baseline).
- Decommissioned: choose Decommission at year to retire the feature at the slider's current year, or type a year. Clear the field to mark the feature as still live again.
To edit several features at once, switch the attribute editor to Table. In a timeline, the first two columns of the table are always the built and decommissioned years, so you can enter a retirement year even if no feature has one yet. Choose Save to re-tile when you're done.
What the slider shows
When you drag the slider, the map redraws straight away without reprocessing the dataset. At any year, each feature is in one of four states:
| State | When | On the map |
|---|---|---|
| New this year | built in this year | Highlighted, so this year's additions stand out from what was already there. |
| Live | built, not yet retired | Your normal styling for the layer. |
| Retired | decommissioned this year or earlier | Ghosted, so you can still see where it was while editing. |
| Future | built after this year | Hidden until its built year. |
Compare two timelines
After you save a timeline, you can open it in Compare, the side-by-side swipe view you start from the maps list. Pick two timelines, drag the divider to move between them, and move the shared year slider to see how the two build-outs differ. In Compare, retired features are hidden from their decommission year instead of being ghosted.
Troubleshooting
- I drew a feature but it is dated years in the future
- New features get the year shown on the slider as their built year, so set the slider to the right year before you draw. To fix a feature you've already placed, select it and change its Built year.
- A feature never disappears when I move the slider forward
- The feature has no decommission year, so it stays live. Give it a Decommissioned year (or use Decommission at year) and save.
- Every feature shows at every year, whatever the slider says
- Those features have no built year, so they are baselines, which always show. Set a built year on each feature that should appear at a particular time.
- Fork as Timeline is refused, or the button is missing
- You can fork a dataset only if it belongs to you, its status is Ready, and it is small enough (up to 2000 features / 2 MiB). You can't fork a larger layer, one that is still processing, or a shared reference layer. Bring large data in as a full dataset instead.
- The years won't save
- Built and decommissioned years must be whole numbers, and the decommissioned year can't be earlier than the built year. The save error tells you which value is wrong. Fix it and save again.
See also
- Query and model data with SQL: you can use a timeline as a model input, and its year fields are ordinary columns.
- Publish and share a map: add a timeline to a map and share it.
- Your first map: from upload to a published map, if you're new to mapbench.