location2gpx

Crates.iolocation2gpx
lib.rslocation2gpx
version0.1.0
sourcesrc
created_at2023-03-31 01:40:14.771423
updated_at2023-03-31 01:40:14.771423
descriptionGPX file generator
homepage
repositoryhttps://github.com/fernandobatels/location2gpx
max_upload_size
id825869
size115,377
Luis Fernando Batels (fernandobatels)

documentation

README

location2gpx

Crate API github sponsors

GPX file generator from consolidated sources.

Visualize or manipulate your tracks with a .gpx file from raw data in mongodb collections or CSV.

How location2gpx works

  1. Connect to your source and fetch all the records of provided range
  2. Groups all your positions by a device and route
  • Each device + route will be a GPX track
  1. Track positions will be split by a maximum time value into GPX track segments
  • In segment you have all points with elevation, speed and time
  • If desired, each track segment can be simplified with the Visvalingam-Whyatt algorithm
  1. Your GPX file are ready

How to use

With mongodb:

cargo run -- mongo "mongodb://localhost:27017/yourdb" yourcollection "2020-01-01T00:00:00.000+00:00" "2020-12-31T00:00:00.000+00:00" /tmp/my-tracks-2020.gpx

With CSV file:

cargo run -- csv yourfile.csv "2020-01-01T00:00:00.000+00:00" "2020-12-31T00:00:00.000+00:00" /tmp/my-tracks-2020.gpx

Output will be like this sample.

How configure fields

To configurate, you need to setup a yaml file and use the --config parameter. You can also leave your config on your $HOME with ~/.loc2gpx.yaml.

Configuration example:

fields:
  device_id: dev_id
  time: dev_time
  coordinates: coords
  # route:
  # elevation:
  # speed:
segments:
  vw_simplify: 0.000001 # Tolerance for Visvalingam-Whyatt simplification algorithm
  max_segment_time: 300 # Max segment time(in seconds) allowed

Help messages

General:

CLI of location2gpx - Convert your raw GPS data into a GPX file

USAGE:
    location2gpx <SUBCOMMAND>

OPTIONS:
    -h, --help    Print help information

SUBCOMMANDS:
    csv      Generate a GPX from a CSV file source
    help     Print this message or the help of the given subcommand(s)
    mongo    Generate a GPX from a mongodb collection source

Mongodb command:

Generate a GPX from a mongodb collection source

USAGE:
    location2gpx mongo [OPTIONS] <CONNECTION> <COLLECTION> <START> <END> <DESTINATION>

ARGS:
    <CONNECTION>     Mongo connection string source
    <COLLECTION>     Mongo collection name
    <START>          Start time, RFC3339 format
    <END>            End time, RFC3339 format
    <DESTINATION>    GPX path file destination

OPTIONS:
        --config <CONFIG>    Fields and segments configuration. Default: .loc2gpx.yaml, ~/.loc2gpx.yaml
    -h, --help               Print help information

CSV command:

Generate a GPX from a CSV file source

USAGE:
    location2gpx csv [OPTIONS] <CSV_PATH> <START> <END> <DESTINATION>

ARGS:
    <CSV_PATH>       CSV file source
    <START>          Start time, RFC3339 format
    <END>            End time, RFC3339 format
    <DESTINATION>    GPX path file destination

OPTIONS:
        --config <CONFIG>    Fields and segments configuration. Default: .loc2gpx.yaml, ~/.loc2gpx.yaml
    -h, --help               Print help information

Goals

  • Generate tracks on a gpx file from a collection
  • Apply a simplification algorithm on track segments
  • Support devices and routes distinctions
  • Support mongodb source
  • Support CSV source
  • Support firebird source
Commit count: 30

cargo fmt