Route Maps

A map block for any WordPress page: your own places, GPX lines and a Directions link for each place. No key and no account.

It started as the maps inside the Event and Club kit and is now a plugin of its own. Add the Map block to a page, drop your places on it and add a GPX if you have one. It works in any theme. The maps come from OpenFreeMap, so there’s no API key to get.

Download Route Maps See the examples

WordPress 6.5+ · PHP 8.0+ · free

Examples

These are the plugin running on this page, all drawn by its one block, Map. Each example lists the settings it uses. The routes and places are made up.

A course with its checkpoints

One GPX line and three places, numbered, each with a Directions link under the map. The Download the GPX button lets people put the route on their watch or phone.

Uses Map block Liberty look 1 GPX line Numbered places Directions links Download the GPX

Meeting points, no line

Plain pins for where a club meets, in the pale Positron look so the marks stand out.

Uses Map block Positron look Plain pins Directions links

Another look, and it waits for a press

The Dark look with an orange line. Nothing loads until someone presses Show the map. That’s worth doing when:

  • The page is long and the map is near the bottom. The map library is nearly 1MB of script before a single map tile, which is a lot to ask of a phone on one bar of signal at a race start.
  • Most people come for something else. Someone reading the results doesn’t need the course map loading underneath them.
  • You’d rather nothing went to another server unasked. Until the press, the visitor’s browser doesn’t contact the map server at all.

The elevation profile under it is drawn into the page itself, so the distance, the climb and the shape of the route are there before anyone presses anything.

Uses Map block Dark look Own colour 1 GPX line Wait for a press Elevation profile

The map sits behind a button and opens over the page.

Uses Map block Fiord look 1 GPX line Show in a popup Button text

What you can set

  • Places: as many as you like. Click the small map in the block’s settings to drop one, drag it to the exact spot, or type a name and press Find on map.
  • Lines: up to six GPX files. Each one is cleaned when it’s uploaded (see below).
  • Looks: five map styles (Liberty, Bright, Positron, Fiord and Dark), or a MapLibre style of your own, and any colour for the marks and the line.
  • Under the map: the places listed with a Directions link each, numbered or as plain pins.
  • Elevation profile: a switch on any map with a GPX line adds its distance, climb and a profile of its heights under the map.
  • Download the GPX: another switch puts a download button under it.
  • Loading: a map loads when it’s scrolled to, when someone presses a button, or when its popup opens.
  • The editor’s own controls: colour, spacing, border, corners, shadow and text size all work on the block.

In the editor

The Map block draws the real map while you edit, so what you see is what goes on the page. Everything is set in the block’s sidebar.

The WordPress editor with a Map block selected: the coast route in orange with two numbered places, an elevation profile, the places listed with Directions buttons and a Download the GPX button. The sidebar shows the Places panel with a small map and the first place's name, note, latitude and longitude.
The Map block selected, with the Places panel open. Click the small map to add a place, or drag a mark to move it.
The GPX lines panel: one file, Coast Out And Back, with a Remove link, an Add a GPX file button, and two switches, Show the elevation profile and Show a Download the GPX button, both on.
GPX lines. The files, and the switches for the profile and the download.
The Look panel: a Map style menu set to Liberty, a colour picker for the marks and the line set to orange, and sliders for height (420px) and zoom (12).
Look. Map style, your colour, height and zoom.
The Display panel: a heading field, a Show the map menu set to On the page, and switches to number the places, list them, add Directions links and wait for a press before loading.
Display. On the page or in a popup, the list under the map, and waiting for a press.

What happens to a GPX when you upload it

A GPX exported from a watch or Strava carries a lot more than the route: the time at every point, your heart rate and cadence, the device, the activity’s name and often your own name. Once a map has a Download button, all of that would go to anyone who saves the file.

So Route Maps rewrites every GPX as it’s uploaded and keeps only the line: the latitude, longitude and height of each point, and the position and name of any waypoints. Everything else is dropped. The copy in your media library is the clean one, and the original isn’t kept.

It also means nothing written inside the file ends up on your page. If a file has no route in it that can be read, it’s refused rather than stored as it arrived. A developer who needs the original files can switch the cleaning off with the racerpacer_maps_clean_gpx filter.

Without the block editor

A shortcode draws the same map in the classic editor or a page builder:

[[rpmap_map points="54.6005,-3.1342,Start|54.6470,-3.1439,Checkpoint 1" gpx="123" look="positron" profile="yes" download="yes"]]

The gpx number is the GPX file’s ID in the media library.

There’s a step-by-step guide to the Map block, and every shortcode option, in the kit’s docs. If you need help, contact me.

Cookie preferences

Choose which optional cookies you allow. Strictly necessary cookies are always on. You can change your mind at any time from the cookie settings link.

Read our privacy policy