|  |  | The `translate` Command

## The `translate` Command

The `translate` command reads information from a file in a given format and writes it to another file in another given format:
`translate IN-FORMAT [IN-PARAMS] [IN-TYPES] IN-PATH` `[HOW-PARAMS]` `\`
`OUT-FORMAT [OUT-PARAMS] [OUT-TYPES] OUT-PATH`
where:

- `IN-FORMAT [IN-PARAMS]` and `OUT-FORMAT [OUT-PARAMS]` are the input file format and the output file format and their parameters (if any); use `show formats` for a list of the currently accepted formats;
- `IN-TYPES` are the data types to read; the possible types depend on the input format and some formats impose that there is a single data type per file; they may be absent if the format requires a unique data type or if the files can have items of different types; `all` can be used as an abbreviation of `WP RT TR LN`;
- `IN-PATH` is the path to the file to read from, or, in the case of the `Shapefile` format, the path to the Shapefiles basename (file extensions will be discarded). If the `IN-PATH` is `stdin` input will be from the standard input unless the format is the `Shapefile` format (in which case the command fails);
- `HOW-PARAMS` specify how to translate the file; for the time being they are only used for overriding the time offset of GPSMan files and take the form:
  - `itoffset=DHOUR` time offset to use in input file in GPSMan format; defaults to time offset given in file;
  - `otoffset=DHOUR` time offset to use in output file in GPSMan format; defaults to time offset selected in the options;
- `OUT-TYPES` may be absent in which case they are taken to be `IN-TYPES` what is valid only when they are all valid for the selected output format; if `RT` occurs in `IN-TYPES` then `WP` can appear in `OUT-TYPES` but no other type "conversions" are allowed; some file formats impose that there is a single data type per file; `all` can be used as an abbreviation of `WP RT TR LN`;
- `OUT-PATH` is the path to the output file, or, in the case of the `Shapefile` format, the path to the Shapefiles basename (file extensions will be discarded). If the `OUT-PATH` is `stdout` output will be to the standard output unless the format is the `Shapefile` format (in which case the command fails). Existing files will be silently overwritten.

Examples: the following command

    translate gpsman data/myWPRTs Shapefile dim=2 pformat=UTM datum="WGS 84" \
        RT sroutes

reads the data in the GPSMan file `data/myWPRTs` and writes the routes in it to Shapefiles with basename `sroutes`, with no altitude information (2 dimensions) and using UTM coordinates for the WGS84 datum (note that a Shapefile set can only have items of a single type). The command

    translate gpsman data/myWPRTs gpsman WP data/myWPs

creates from the same input file a GPSMan file `data/myWPs` that only has the waypoints. With

    translate gpsman data/myData itoffset=1 gpsman TR data/myTRs

does a similar thing with tracks but assumes the time offset of the input file is 1, overriding the value given in the file.

|  |  | The `translate` Command