Filtering out GPX positions when accuracy is less than 10 m
This commit is contained in:
parent
5404a6e5ad
commit
bf179a4b6d
|
@ -42,7 +42,10 @@ const GpxRecord: Component<{}> = (props) => {
|
|||
location.time - globalThis.$lastValidLocationTime
|
||||
}`
|
||||
);
|
||||
if (location.time - globalThis.$lastValidLocationTime > 15000) {
|
||||
if (
|
||||
location.accuracy < 10 &&
|
||||
location.time - globalThis.$lastValidLocationTime > 15000
|
||||
) {
|
||||
globalThis.$lastValidLocationTime = location.time;
|
||||
await dispatch({
|
||||
action: 'appendTrkpt',
|
||||
|
@ -62,7 +65,7 @@ const GpxRecord: Component<{}> = (props) => {
|
|||
},
|
||||
},
|
||||
});
|
||||
setCurrentLocation({lon:location.longitude, lat:location.latitude});
|
||||
setCurrentLocation({ lon: location.longitude, lat: location.latitude });
|
||||
const state = getState();
|
||||
navigate(
|
||||
`/map/${state.provider}/${location.longitude}/${location.latitude}/${state.zoom}/${state.rotation}`
|
||||
|
@ -87,7 +90,7 @@ const GpxRecord: Component<{}> = (props) => {
|
|||
const trkIdObj = getUri('trk', trkId);
|
||||
setTrksegId({ ...trkIdObj, trkseg: 0 });
|
||||
globalThis.$lastValidLocationTime = 0;
|
||||
const id = await startBackgroundGeolocation(newLocationHandler, 20);
|
||||
const id = await startBackgroundGeolocation(newLocationHandler, 10);
|
||||
setWatcherId(id);
|
||||
setState('recording');
|
||||
setOpen(false);
|
||||
|
@ -99,7 +102,7 @@ const GpxRecord: Component<{}> = (props) => {
|
|||
};
|
||||
const resumeRecordingHandler = async () => {
|
||||
setTrksegId({ ...trksegId()!, trkseg: trksegId()!.trkseg + 1 });
|
||||
const id = await startBackgroundGeolocation(newLocationHandler, 20);
|
||||
const id = await startBackgroundGeolocation(newLocationHandler, 10);
|
||||
setWatcherId(id);
|
||||
setState('recording');
|
||||
setOpen(false);
|
||||
|
|
Loading…
Reference in New Issue