banner

Introduction

I used to try to maintain a list of campsites in western Europe, with location, website links and contact information. But the list changed so frequently that it was too much work to maintain. Instead I now describe how you can get this information for yourself. Some Linux tools are employed but you can often find tools online to do the same step.

Prologue

  1. Install GPSBabel.

Getting data from overpass-turbo.eu

  1. Go to the Overpass Turbo website.
  2. Paste the following text into the left panel of that web page, replacing any text already there:
[out:json][timeout:60][bbox:{{bbox}}];

node["tourism"="camp_site"];
out;

way["tourism"="camp_site"];
out center;

relation["tourism"="camp_site"];
out center;
  1. For those interested, that means:
    1. the output from the program should be in JSON format (note that we'll export the data in GPX format),
    2. searches that do not complete in 60 seconds should be terminated,
    3. the area to search is that that is visible on the map on the right part of the screen,
    4. from the data for the search area, points ("nodes") noted as campsites should be filtered for and then outputted,
    5. from the data for the search area, lines ("ways") noted as the perimeters of campsites should be searched for and then their centre outputted,
    6. from the data for the search area, lines made of smaller lines ("relations") that are noted as the perimeters of campsites should be searched for and then their centre outputted.
  2. Pan and zoom the map to cover the area you want.
  3. Press the 'Run' button and wait for the search to complete. If you get a timeout then adjust to map to cover a smaller area and try again.
  4. Verify that you can see the campsites marked on the map.
  5. Press the 'Export' button and then click 'GPX download', saving the data to filename file1.gpx.
  6. If you want data about more campsites in other areas then repeatedly:
    1. adjust the map,
    2. press the 'Run' button,
    3. press the 'Export button and then click 'download as GPX', saving the data to a new filename (e.g. export1.gpx, export2.gpx, export3.gpx).
  7. Make a shell array containing all those names:
    EXPORTED_GPX_FILES=( export*.gpx )

More information about the Overpass query language can be found here.

Noting GPX files of campsites from other holidays that contain relevant campsuites

  1. If you have no old GPX files that might contain relevant campsite waypoints then complete the following sub-procedure:
    1. Run:
      gpsbabel -i csv -f /dev/null -o gpx -F empty.gpx
      OTHER_GPX_FILES=( empty.gpx )
  2. If you do have old GPX files that might contain relevant campsite waypoints then complete the following sub-procedure:
    1. List all old GPX files of campsites with something like:
      ls -1d ~/doc/def/travel/holidays/*/waypoints/camps.gpx | egrep -v '(ignore1|ignore2|...)'
      and keep adjusting the egrep until the list looks sensible.
    2. Run the command:
      readarray -t OTHER_GPX_FILES < <(<your-previous-command>)

Merging and deduplicating

  1. Run the command:
    echo gpsbabel -i gpx $(for F in "${EXPORTED_GPX_FILES[@]}" "${OTHER_GPX_FILES[@]}"; do echo "-f \"$F\" "; done) \
    -x duplicate,location \
    -o gpx -F merged-and-deduplicated.gpx
    (Note echo needs no '--' to echo '-f'.)
  2. Verify that the output looks correct and then run it again replacing the first 'echo' with 'eval'.
  3. Note that the file can still contain duplicates: old holidays may record the position of campsites slightly different to OpenStreetMap, so these will show up as duplicates.

Ignore camps too far from route

If you already have a route in a GPX file then you can remove from your list of campsites those campsites that are too far away from your route.

  1. For the purposes of finding campsites within a certain distance of the route, the route file needs to be converted to arc format:
    gpsbabel -i gpx -f my-route.gpx \
    -o arc -F my-route.arc
  2. Filter the campsites file, which we assume is called deduplicated.gpx, with the command:
    gpsbabel -i gpx -f merged-and-deduplicated.gpx \
    -x arc,file=my-route.arc,distance=12K \
    -o gpx -F filtered.gpx
    (In that example '12K' sets distance beyond which campsites are to be filtered out is set to 12Km, see the documentation for gpsbabel's arc filter for more details.)
  3. Load the original route into a GPX viewer/editor and then load filtered.gpx and verify it looks correct.

Reformatting the data

Often it is necessary to manually edit the GPX file. This is a lot easier if line breaks are added between fields.

  1. Install Tidy.
  2. Run the command:
    tidy -q -xml -i filtered.gpx > tidied.gpx
  3. For those interested, that means:
    1. suppress nonessential output
    2. the input format is XML (GPX is an XML schema)
    3. indent element content

More information about Tidy's many options and filters can be found here.

Viewing/editing the data

There are many applications and websites to do this. My favourite is GORP, but it is only available in German.