Parsing GPX files.

This commit is contained in:
vdv committed 2022-09-22 21:50:39 +02:00
1 parent c545ff1d15
commit a559a37952
20 files changed
+459 -21

No files matched your search

+4 -2
View File
@@ -1,13 +1,13 @@
import React from 'react';
import { Geolocation } from '@awesome-cordova-plugins/geolocation';
import { useDispatch } from 'react-redux';
import { mapActions } from '../../store/map';
import GPX from '../../lib/gpx-parser-builder';
import '../../theme/get-location.css';
import { IonIcon, IonItem } from '@ionic/react';
import { downloadSharp } from 'ionicons/icons';
import { tracksActions } from '../../store/tracks';
const GpxImport: React.FC<{}> = () => {
const dispatch = useDispatch();
@@ -23,6 +23,8 @@ const GpxImport: React.FC<{}> = () => {
() => {
// this will then display a text file
console.log(fileReader.result);
const track = GPX.parse(fileReader.result);
dispatch(tracksActions.push(JSON.parse(JSON.stringify(track))));
},
false
);