Using GPX files with Geocoder and Geofield

Last updated on
17 April 2024

Here's how to set up Geofield, Geocoder, and Leaflet (optional) to display a track uploaded in .gpx file format.

  1. Install Geocoder, Geocoder Field, Geocoder Geofield, Geofield, and Leaflet (optional)
  2. Create a "GPX File" Geocoder provider under /admin/config/system/geocoder/geocoder-provider
  3. Create a file field in a content type, used to upload a GPX file
  4. Create a Geofield field in a content type, allowing only one value
  5. Set up the Geofield field like this:
    • Geocode → Geocode from an existing field
    • Geocode from an existing field → select file field used to upload the GPX file
    • Geocoder plugins → checked "GPX File"
  6. For the Geofield field, in "Manage display" choose "Leaflet Map" (if available) or just "Raw Output"
  7. Create new content with an attached GPX file
  8. The Leaflet map should show the route or point, or if raw value used, something like POINT (2.862523 42.874582) or MULTILINESTRING ((-3.4584857337177 48.72786023654 [...]

Help improve this page

Page status: No known problems

You can: