Add GPX track importer
This commit is contained in:
parent
dd9d421f9e
commit
0f252016b0
1 changed files with 23 additions and 0 deletions
23
importers/gpx-tracks
Executable file
23
importers/gpx-tracks
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
|
||||
usage () {
|
||||
echo "Recursively imports all gpx tracks in a directory into an SQLite database."
|
||||
echo ""
|
||||
echo "Usage: $(basename $0) directory target-database"
|
||||
}
|
||||
|
||||
gpx_directory="$1"
|
||||
target_database="$2"
|
||||
|
||||
# basic argument verification
|
||||
case "$@" in -h|--help) usage && exit 0;; esac
|
||||
[ -z "$gpx_directory" ] && usage && exit 1
|
||||
[ -z "$target_database" ] && usage && exit 1
|
||||
|
||||
# recursive scan and import
|
||||
while IFS= read -d '' -r file; do
|
||||
spatialite_xml_load -d "$target_database" -x "$file"
|
||||
done < <(find "$gpx_directory" -name '*.gpx' -print0)
|
||||
|
||||
# TODO: Create virtual joined table
|
||||
Loading…
Add table
Add a link
Reference in a new issue