Google Sheets-powered map of visited railway stations, inspired by t5r7's station mapper.
- Powered by Cloudflare Pages and Cloudflage Pages Functions
- Data stored in easily-maintainable Google Sheets
- Automatically updates map when data changes
- Uses performant, self-hosted vector OSM tiles with MapLibre GL JS
- Show transit operator branding
- Filter by transport type (light/heavy rail, etc.)
By default, stations with a visitedDate
in the future are hidden from the map. These can be shown by pressing the "Show future stations" link
at the bottom of the webpage, or by adding ?future=true
to the URL. When shown, these will appear in greyscale and state "Planned to visit" in
their information pop-up.
- Clone the repository
- Install dependencies with
yarn install
- Run with
yarn dev
Changes are automatically deployed using GitHub Actions to Cloudflare Pages when pushing to the deploy
branch.
You'll need a Cloudflare account for this unless you change how the project works. You can sign up for free at Cloudflare, and usage should happily fit within your free usage limits. You don't need to add a payment method to use Cloudflare Pages.
-
Fork and update repository and code
- Fork this repository
- On your fork, enable Actions through the Actions tab
-
Create a clone of my Google Sheet and start filling it in with your own data
-
Update code as required
-
Update the Google Sheet ID in
functions/api/stations.ts
-
You will also need to update the
html/map.js
file to use the default OSM raster tile server by swapping the lines specified in the code comments. By default, it will attempt to use my own self-hosted vector tile server, which will not work for you.Info
You can change the tile server URL to another map tile provider if you wish by editing
html/map-styles/osm-raster.json
-
-
Create a new Pages project
- In your Cloudflare account head to "Workers & Pages", then "Create application".
- Choose the "Pages" tab, then "Upload assets".
- Enter a name for your project, such as "visited-stations-map"
- Press Create
- Just go back to the "Workers & Pages" section now; you don't need to upload any assets like it is asking.
-
Create a Cloudflare API token
- Clicking the user icon in the top right, and go to My Profile
- Choose "API Tokens", then "Create Custom token"
- Give it the "Cloudflare Pages" permission for your account.
- Hit "Continue to summary", then "Create token".
- Make a copy of this. You can't view it again after you leave the page.
-
Add the API token and your account ID to your GitHub repository secrets
- Go to your repository, then "Settings", then "Secrets and variables"
- Add a new repository secret called
CLOUDFLARE_API_TOKEN
with the value of your API token - Add a new repository secret called
CLOUDFLARE_ACCOUNT_ID
with you Cloudflare account ID- This is in the URL to your Cloudflare Dashboard, e.g. for
https://dash.cloudflare.com/1234567890abcdef
,1234567890abcdef
is your account ID
- This is in the URL to your Cloudflare Dashboard, e.g. for
- Add a repository variable named
CLOUDFLARE_PAGES_PROJECT
with the name of your Pages project
-
Commit the changes to the
functions/api/stations.ts
file, then open and merge a pull request from themain
branch to thedeploy
branch -
The website should be automatically deployed to Cloudflare Pages. You can add a custom domain through the Cloudflare Dashboard as required.