Contents

UK Map Generator

   Sep 3, 2025     5 min read

UK map image generator

This application is used to generate a map of the UK showing counties and routes walked within them counties, the resulting uk_map.png file, his intended call from within a web page, and viewable online. This tool is quite capable of generating maps for any country, not just the UK.

A strong point of this tool, is that the entire map is rendered from data, and that the Python scripts can be rerun and global changes implemented. This is viewed as better than an editor, where an image can be tweaked, but then never regenerated.

The boundary information is originally sourced from https://csmale.dev.openstreetmap.org/os_boundaryline_202405/index.html

  These programs run on a home PC
  sources to generate the uk_map.png map can be found in
  
  P:\DevelopmentCode\Python\AllCountiesWalks
  
  Open a cmd window and navigate to this directory, to build everything run 
    python generate_counties_info.py
  and 
    python generate_uk_map.py
  
  Or more typically just run
    python generate_uk_map.py
  to update the walks

  It should finish with the message
  ✅ Map saved as uk_map.png at ~9000 x 9000 pixels

  if you DO run under powershell, to avoid any error messages first run
  chcp 65001

Two separate Python files are used to generate the uk_map.png file,

- generate_counties_info.py

    Builds a set of vectors which detail the boundary limits, boundary names and positioning of those names,
    these are stored in a file called counties.geojson
    It uses a file boundary_hints.csv, which provides boundary names and positioning of those names.
    This takes time to run and is viewed as an infrequent action.

- generate_uk_map.py

    It uses the output from the first,
    and overlays on it a set of routes already walked held in .\routes_walked , 
    and routes planned to be walked held in .\routes_to_be_walked

This is illustrated below:

P:\DevelopmentCode\Python\AllCountiesWalks
│
├── generate_counties_info.py
│     │
│     ├── Uses: boundary_hints.csv
│     │        (boundary names + label positions)
│     │
│     ├── Uses: .\historic_counties_gpx\
│     │        (boundary positions for counties)
│     │
│     └── Generates: counties.geojson
│              (county vectors + boundaries + names/positions)
│
└── generate_uk_map.py
      │
      ├── Uses: counties.geojson        <-- output of generate_counties_info.py
      ├── Uses: .\routes_walked\        <-- completed routes
      ├── Uses: .\routes_to_be_walked\  <-- planned routes
      │
      └── Generates: (Final web-facing) uk_map.png
               (map of UK counties + routes overlayed - formatted for viewing online)

Example boundary_hints.csv file

# Expected folder structure:
#
#     ./historic_counties_gpx   -> GPX files for county borders
#     ./routes_walked           -> GPX files for walking routes
#     boundary_hints.csv        -> CSV with filename and label positioning hints
#
# justification – affects horizontal alignment of the text:
#
# L → left
# R → right
# C → center
#
# horizontal – determines horizontal position of the label within the county boundary:
#
# L → left
# R → right
# M → middle
#
# vertical – determines vertical position of the label within the county boundary:
#
# T → top
# M → middle
# B → bottom
#
# filename                  , boundary_colour , justification, horizontal, vertical,  text_colour,  text_background
Aberdeen.gpx                , pink            , L            , R         , M        , white       , green
Aberdeenshire.gpx           , red             , L            , R         , M        , white       , green
Anglesey.gpx                , blue            , R            , L         , M        , white       , green
Angus.gpx                   , green           , M            , M         , M        , white       , green

Example Generated UK Page

Example Generated UK Page

WALKS / RAMBLES

ENGLAND

    Avon

    Bedfordshire (2025)
        greensandridgewalk.gpx (section from Lidlington to Maulden)
        Walk from Lidlington station, join start of greensandridgewalk, walked to the White Hart at Maulden

    Berkshire

    Buckinghamshire (2025)
        Train to Wolverton (From Milton Keynes)
        walk along Grand Union Canal towards Cosgrove 
        walk to Iron Trunk Aqueduct 52.068800° -0.833700° 
        then onto Cosgrove (Horse Tunnel and The Barley Mow)
        then walk back to the Iron Trunk Aqueduct
        then follow route to Stony Stratford

    Cambridgeshire
    Cheshire
    Cleveland
    Cornwall
    County Durham
    Cumbria
    Derbyshire
    Devon
        Lyme Regis (visit only)

    Dorset (2025)
        Weymouth to the Smugglers Inn, Osmington Mills / South Dorset Ridgeway
        The X53 bus service runs from Exeter to Abbotsbury, stopping at Swyre which is just north-west of West Bexington.
        The X53 also runs from Osmington to Weymouth, where you can pick up trains to Dorchester.

    Essex
    Gloucestershire
    Hampshire
    Herefordshire
    Hertfordshire
    Isle of Wight
    Kent
    Lancashire
    Leicestershire
    Lincolnshire
    London (Greater London) (2025)
        Saturday, 24th May 2025

        Buy Day Return to London Bridge, catch 9.28 from Brighton Station ( 9.32 Preston Park).  
        Walk across bridge to Eastcheap, catch No 15 bus to Limehouse Station.  Walk via Regent's Canal ( coffee stop), Hertford          Union Canal, Victoria Park ( caf� or picnic).  
        Then Lea River and Limehouse Cut ( tea stop)..  
        Return by No 15 bus.
        
    Merseyside
    Middlesex
    Norfolk
    North Humberside
    North Yorkshire
    Northamptonshire (2025)
    Northumberland
    Nottinghamshire
      Train - Milton Keynes Central - Bletchley - Bedford - Wellingborough
      Wellingborough area walk
  
    Oxfordshire
    Shropshire
    Somerset
    South Humberside
    South Yorkshire
    Staffordshire
    Suffolk
    Surrey
    Sussex (2025)
      Woodingdean to Lewis
      Bus 2 to start of walk, get off at Downs pub(hotel)?
      Eat at xxx at the end of the walk
  
    Tyne and Wear
    Warwickshire
    West Midlands
    West Yorkshire
    Wiltshire
    Worcestershire

SCOTLAND

Neptune's Staircase, Banavie, near Fort William

    Aberdeenshire
    Angus
    Argyll
    Ayrshire
    Banffshire
    Berwickshire
    Caithness
    Clackmannanshire
    Dumfriesshire
    Dunbartonshire
    East Lothian
    Fife
    Inverness-shire
    Isle of Arran
    Isle of Barra
    Isle of Benbecula
    Isle of Bute
    Isle of Canna
    Isle of Coll
    Isle of Colonsay
    Isle of Cumbrae
    Isle of Eigg
    Isle of Gigha
    Isle of Harris
    Isle of Iona
    Isle of Islay
    Isle of Jura
    Isle of Lewis
    Isle of Mull
    Isle of North Uist
    Isle of Rhum
    Isle of Scalpay
    Isle of Skye
    Isle of South Uist
    Isle of Tiree
    Kincardineshire
    Kinross-shire
    Kirkcudbrightshire
    Lanarkshire
    Midlothian
    Morayshire
    Nairnshire
    Orkney
    Peeblesshire
    Perthshire
    Renfrewshire
    Ross-shire
    Roxburghshire
    Selkirkshire
    Shetland
    Stirlingshire
    Sutherland
    West Lothian
    Wigtownshire

WALES

    Clwyd
    Dyfed
    Gwent
    Gwynedd
    Mid Glamorgan
    South Glamorgan
    Powys
    West Glamorgan

NORTHERN IRELAND

    County Antrim
    County Armagh
    County Down
    County Fermanagh
    County Londonderry
    County Tyrone