Building the Canal Traders Map — From Scratch to v1.1.88

One of the more satisfying parts of building Canal Maps has been watching the Canal Traders Map grow from a rough idea into something that real traders out on the cut are actually using. This post covers where it came from, how it works under the hood, and the features that have been added along the way.


The problem it solves

Canal traders — the boats selling food, crafts, boat services, chandlery and everything else — move around constantly. A trader might moor up at one place for a week, then be thirty miles away the next. There was no reliable way for boaters to find them. Canal Traders gives traders a simple way to pin their current location on a map and set the dates they’ll be there, so anyone passing through can see who’s nearby and when.


A standalone auth system

The first architectural decision was one that shapes the whole plugin: Canal Traders does not use WordPress user accounts. Traders log in with their own email and password, and the plugin maintains a completely separate session table with a 30-day cookie.

This keeps traders entirely separate from the WordPress admin, means there’s no confusion with the boat logger or any other system, and makes the plugin genuinely portable if it ever needs to move. The REST API (ct/v1/ namespace) handles login, session management, profile reads, and location CRUD — all authenticated via the session cookie.


Two types of trader

Early on it became clear that not all traders are on boats. Canalside shops, cafes and permanent chandleries wanted to be on the map too. So the plugin now handles two trader types:

  • Boat traders — must have a boat name and their posted location must be within 500 metres of the canal (checked against the canal GPX data). The 500m threshold is intentionally generous to account for marinas, event fields and boatyards that sit back from the actual channel.
  • Canalside traders — have a physical address and no canal proximity restriction at all.

Fixed Mooring locations bypass the proximity check regardless of type — some permanent moorings are just far enough from the GPX centreline to fail the check even though they’re perfectly valid.


The map itself

The public map is rendered with Leaflet and overlays the canal network (parsed client-side from a GPX file, split on gaps greater than 0.009° to draw separate canal segments correctly). Markers use category icons at 36×36px with a proper anchor and popup offset. When multiple traders are close together, Leaflet.markercluster groups them into a navy circle showing the count — the cluster icon is built entirely with inline styles to prevent Leaflet’s own CSS from overriding the theme colours.

There’s a date-range filter bar so visitors can look ahead — traders can post locations up to a month in advance, which is useful for planned festival appearances or events.


Categories driven from the database

Categories (Food & Drink, Crafts & Art, Boat Services, etc.) are not hardcoded. They live in a table with slug, label, colour, icon URL and sort order. Admins can add, edit or delete categories from the WordPress admin with the WordPress Media Library for icon uploads. This turned out to be the right call — the category list has already changed several times as more traders have signed up with different needs.


Known locations picker

Rather than asking traders to find themselves on a blank map every time, there’s a known locations picker that queries a list of named spots — marinas, event venues, popular visitor moorings, festivals — joined from the Canal Map’s POI data. A trader picking a location sees a searchable list of these places and can jump straight to the right spot, which both saves time and ensures consistent coordinates for recurring venues.


Per-day opening hours

Once traders were posting their locations, the next obvious request was opening hours. This lets a trader say they’re at a mooring for a week but closed on Tuesdays, or open early on Saturday for the morning market.


A date bug that took a while to find

JavaScript’s toISOString() seems like the obvious way to get a date string. But in British Summer Time, midnight on a Monday local time is 23:00 Sunday UTC. So toISOString() gives you the wrong date for anything that crosses midnight — which is exactly when people are picking date ranges for their location.

The fix was a  function that builds the date string from getFullYear(), getMonth() and getDate() (all local time) rather than touching UTC at all. It’s a small thing but it was causing off-by-one date errors for half the year.


Embed your map

Traders wanted to share their location map on their own website or social profiles. The embed feature generates a standalone full-screen page at /?ct_embed=1&trader={id}&days={n} — no WordPress theme, no navigation, just the map. Special headers strip X-Frame-Options and set a permissive Content-Security-Policy: frame-ancestors * so the map can sit inside an <iframe> anywhere. Traders get a code snippet with a timeframe dropdown (7, 14, 30, 90 days, or All) that updates the iframe src automatically.


Backup and restore

The plugin uses .ctt files (a ZIP containing JSON) for backup and restore — analogous to the boat logger’s .blb format. Admins can download a full backup of all trader data. Traders themselves can download and restore their own data, authenticated via the CT session cookie rather than a WordPress login. The admin restore matches traders by email address, which handles the case where a full reinstall has changed the database IDs.


Emailing traders

With a growing list of traders, there needed to be a way to reach them all. The Email Traders admin page lets you compose a message, select recipients (individual traders or all active traders at once, with a live search filter), and send. Templates can be saved and reused, with a placeholder that personalises each email. Sending is done one at a time  with a live progress bar and a status log, and the plugin keeps a sent log for reference.


Mobile UI

The map works on phones, which meant rethinking the controls. On a small screen you can’t afford to have filter panels permanently visible — every pixel of map matters. The solution was edge-mounted slide-out panels triggered by small tab buttons:

  • Left edge — zoom in, zoom out, fit all markers, find my location
  • Right edge — category filter (Leaflet layers control, restyled as a tab)
  • Top edge — date range filter bar, toggled by a ▼ button

Each tab follows a consistent design rule: rounded corners on the free-floating side, flat corners on the side that connects to the map edge or panel. So a right-edge tab is border-radius: 6px 0 0 6px (rounded left, flat right against the map edge). The arrows also follow a rule: closed points toward where the panel will appear, open points toward the edge to indicate “tap to close.” All three panels close when the user taps the map.

Getting the arrow directions consistent took a couple of iterations — one build went out with them backwards and had to be reverted. The rules are now documented so it doesn’t happen again.


Verification admin tools

One pain point that emerged once real traders started signing up was the email verification step. Sometimes the verification email goes to spam, or a trader on a boat with patchy signal doesn’t click it in time and the 48-hour token expires. Previously, the only option was to manually edit the database.

Now there are three admin buttons available on both the traders list and the individual edit page, shown automatically whenever a trader has an unverified token outstanding:

  • 📧 Resend Verification Email — generates a fresh token and sends a new email
  • ✅ Force Verify — clears the token and marks the email as verified without the trader having to click anything
  • 🚀 Complete Setup — verifies and approves the trader in a single click, bypassing the whole flow for cases where you know the trader personally and just want to get them on the map

User manual

A shortcode renders a full user guide directly on the site, so traders don’t need to go anywhere else for help. It covers signing up, adding and editing locations, opening hours, the embed feature, backup and restore, and — most recently — two new sections on using the map on a phone or tablet. Mobile navigation is genuinely different enough from desktop to warrant its own section: the dashboard overlay, how to scroll the page vs interact with the map, the two-finger gesture hint, and a walkthrough of all three slide-out control panels.


Where it is now

At v1.1.88 the plugin has five database tables, a full REST API, its own auth system, category management, known locations, per-day opening hours, embed maps, backup and restore, bulk email, a mobile-optimised map UI, and a built-in user manual. It’s been built incrementally alongside real traders using it, which is the only way these things end up actually working.

© 2026 . | Privacy Policy
Links on this site do not constitute a recommendation or endorsement of any business, product, or service.