GPX Route Map
GPX Route Map turns a GPX file into an interactive map on the front end of your site. Drop the block into any post or page, pick a .gpx file, and visitors get: An interactive map powered by MapLibre GL, on OpenStreetMap, OpenTopoMap or Thunderforest tiles. The track drawn as a route line with start
GPX Route Map turns a GPX file into an interactive map on the front end of your site. Drop the block into any post or page, pick a .gpx file, and visitors get:
- An interactive map powered by MapLibre GL, on OpenStreetMap, OpenTopoMap or Thunderforest tiles.
- The track drawn as a route line with start and end markers.
- Support for both GPX tracks ( <trk> ) and GPX routes ( <rte> ), e.g. Garmin Connect course exports.
- Waypoint markers with popups for any <wpt> points in the file.
- Optional Waypoint posts (experimental), to give a waypoint its own description, a photo shown as its marker, or an icon in your own colors.
- A stats bar: distance, elevation gain, elevation loss, max and min elevation, in metric or imperial units.
- A hand-drawn elevation profile you can scrub with mouse or touch, the position syncs onto the map.
The map loads lazily (only when it scrolls into view) so it never slows down your page, and multiple maps can live on the same page.
You can author tracks in any GPX tool, for example the free gpx.studio editor, then upload the resulting file to your Media Library.
Source code
The front-end JavaScript in build/ is minified (the block editor script is not, so that its strings stay translatable). The human-readable source lives in the plugin’s src/ directory, which is included in this plugin, and is also available with full build instructions at the public repository: https://github.com/SirLouen/gpx-route-map . The plugin is built with Vite ( pnpm install && pnpm run build ).
External services
This plugin renders maps using map images (tiles) served by a third party. Tiles are loaded directly by each visitor’s browser when a page containing a map is viewed, so the tile provider receives that visitor’s IP address, browser User-Agent, and the coordinates of the map area being viewed. The block editor’s map preview and the map on a Waypoint post’s screen load tiles the same way, from the browser of whoever is editing. Choosing a map on a Waypoint post’s screen also makes that browser fetch the map’s GPX file, so if the file is on another site, that site receives the same details. No data is sent when a page has no map on it, and the plugin never sends your GPX files anywhere.