| 开发者 | sirlouen |
|---|---|
| 更新时间 | 2026年9月11日 00:39 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
.gpx file, and visitors get:
<trk>) and GPX routes (<rte>), e.g. Garmin Connect course exports.<wpt> points in the file.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).
gpx-route-map folder to /wp-content/plugins/, or install through the Plugins screen.No. It has no plugin dependencies and works with core WordPress.
Map rendering uses MapLibre GL JS (BSD-3-Clause) with OpenStreetMap raster tiles. The track, elevation profile and the distance/elevation stats are all computed from your GPX file in the browser. When you add the block, those stats are saved with it so the summary still shows without JavaScript.
Yes. Go to Settings > GPX Route Map and set "Units" to Imperial, and every map on the site switches to miles and feet. A single map can use different units from the rest: pick them in the block's Display panel, or add units="imperial" to the shortcode. Switching is instant and can be undone at any time, because the plugin always stores distances and elevations in metric and only converts them for display.
Yes, either one, for the whole site or for a single map. Go to Settings > GPX Route Map and set "Stats bar" or "Elevation profile" to Hidden to change every map at once. To change just one map, use the block's Display panel, or add stats="false" or elevation="false" to the shortcode. A map set to "Site default" follows the setting, so you can change your mind later in one place.
Yes. Under Settings > GPX Route Map, "Stats shown" has a checkbox for each of Distance, Elevation gain, Elevation loss, Max elevation and Waypoints, so you can keep just the ones you care about. A single map can differ: open the block's "Stats bar items" panel, turn off "Use site default" and tick what you want, or pass fields="distance,gain" to the shortcode. At least one figure always stays ticked; to remove the bar altogether use the separate "Stats bar" setting.
Yes, if you switch the download button on. It is off by default. Go to Settings > GPX Route Map and set "Download button" to Shown, or turn it on for a single map from the block's Display panel or with download="true" on the shortcode. The button appears on the map next to the zoom and fullscreen controls. Files in your Media Library download with their own filename; a GPX hosted on another site opens instead of downloading, because browsers only honour the download hint for files served from the same site.
Yes. Sign up at thunderforest.com, then go to Settings > GPX Route Map, set the tile provider to Thunderforest and paste your API key. Pick from the Outdoors, OpenCycleMap, Landscape and Atlas styles. Their free plan covers 150,000 tiles a month, which is roughly 8,000 map views; busier sites need a paid plan. Two things worth knowing. The key appears in your pages' source, because visitors' browsers fetch the tiles, and Thunderforest cannot lock a key to one domain, so watch your usage. And the map credits both Thunderforest and OpenStreetMap automatically, which their terms require and do not allow you to remove.
Yes, set a custom tile URL in the block's Map tiles panel or with the gpxrm_tile_url filter.
Only if that host allows cross-origin (CORS) requests, because the visitor's browser fetches the file directly, and most external sites don't send the required header. The front end then shows "Could not load GPX file." even though the link opens fine in a browser tab. Uploading the file to your Media Library is the reliable option.
GPX files uploaded before this plugin was activated may be stored with a generic XML type or no type at all. The picker shows GPX and XML types; files stored with an empty or unrelated type won't appear. Re-upload them to fix the stored type. On multisite, the network's "Upload file types" setting must also include gpx.
The map library could not be downloaded. The plugin loads its map code as a native JavaScript module, which optimization plugins normally leave alone. But if yours is configured to combine, inline or relocate module scripts, exclude this plugin's view script from it. Visitors on a flaky connection can simply click the message to retry.
{ratio}, the placeholder for providers that serve retina tiles, and notes that the address should use https.fields shortcode attribute.stats and elevation shortcode attributes now follow the site setting when you leave them out, and still accept true or false to force either way.units="imperial" to the shortcode..pot template is bundled for translators.[gpx_route_map] shortcode now fills its stats bar with JavaScript; the block continues to show statistics without JavaScript.[gpx_route_map] shortcode with MapLibre map, waypoints, stats and an interactive elevation profile.