A Flatfile plugin for parsing GPX files and extracting relevant data
npm i @flatfile/plugin-enrich-gpx
A powerful Flatfile Listener plugin for parsing and analyzing GPX (GPS Exchange Format) files. This plugin extracts valuable information from GPX files, performs data processing, and provides statistical analysis.
Event Type:
listener.on('commit:created')
To install the plugin, run the following command:
npm install @flatfile/plugin-enrich-gpx
import { FlatfileListener } from "@flatfile/listener";
import { enrichGpx } from "@flatfile/plugin-enrich-gpx";
export default function (listener: FlatfileListener) {
listener.use(enrichGpx({
sheetSlug: 'gpx-data',
gpxFileField: 'gpx_file',
removeDuplicatesField: 'remove_duplicates',
filterDatesField: 'filter_dates',
startDateField: 'start_date',
endDateField: 'end_date'
}));
}
The plugin accepts the following configuration options through record fields:
sheetSlug
: (Required) The sheet to apply the GPX enrichment to as a stringgpxFileField
: (Required) The field in the record that contains the GPX file content as a stringremove_duplicates
: Set to "true" to remove duplicate pointsfilter_dates
: Set to "true" to filter points by date rangestart_date
: The start date for filtering (when filter_dates
is true)end_date
: The end date for filtering (when filter_dates
is true)gpx_file
field.remove_duplicates
is set to "true", duplicate points are removed.filter_dates
is set to "true" and valid start and end dates are provided, the data is filtered by date range.name
: Name from GPX metadatadescription
: Description from GPX metadatawaypoint_count
: Number of waypointstrack_count
: Number of tracksroute_count
: Number of routestotal_distance
: Calculated total distance in kilometerselevation_gain
: Calculated elevation gain in meterspoint_count
: Total number of points after processingtabular_data
: JSON string of the processed tabular dataThe plugin handles errors gracefully and adds appropriate error messages to the record if parsing fails or required data is missing.