
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
- Install GPSBabel.
Getting data from overpass-turbo.eu
- Go to the Overpass Turbo website.
- 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;
- For those interested, that means:
- the output from the program should be in JSON format (note that we'll export the data in GPX format),
- searches that do not complete in 60 seconds should be terminated,
- the area to search is that that is visible on the map on the right part of the screen,
- from the data for the search area, points ("nodes") noted as campsites should be filtered for and then outputted,
- from the data for the search area, lines ("ways") noted as the perimeters of campsites should be searched for and then their centre outputted,
- 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.
- Pan and zoom the map to cover the area you want.
- 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.
- Verify that you can see the campsites marked on the map.
- Press the 'Export' button and then click 'GPX download', saving the data to filename file1.gpx.
- If you want data about more campsites in other areas then repeatedly:
- adjust the map,
- press the 'Run' button,
- 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).
- 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
- If you have no old GPX files that might contain relevant campsite waypoints then complete the following sub-procedure:
- Run:
gpsbabel -i csv -f /dev/null -o gpx -F empty.gpx
OTHER_GPX_FILES=( empty.gpx )
- If you do have old GPX files that might contain relevant campsite waypoints then complete the following sub-procedure:
- 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.
- Run the command:
readarray -t OTHER_GPX_FILES < <(<your-previous-command>)
Merging and deduplicating
- 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'.)
- Verify that the output looks correct and then run it again replacing the first 'echo' with 'eval'.
- 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.
- 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
- 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.)
- 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.
- Install Tidy.
- Run the command:
tidy -q -xml -i filtered.gpx > tidied.gpx
- For those interested, that means:
- suppress nonessential output
- the input format is XML (GPX is an XML schema)
- 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.