Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Felix/track current trajectory #18

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/app/shared-services/db/sqlite.service.ts
Original file line number Diff line number Diff line change
@@ -126,9 +126,16 @@ export class SqliteService {
message,
} = await this.db.run({
statement: 'INSERT OR REPLACE INTO points VALUES (?,?,?,?,?)',
values: [trajectoryId, time.toISOString(), ...p.latLng, p.accuracy],
// IDK why but with iOS simulator it was not possible to run this without .toFixed()
values: [
trajectoryId,
time.toISOString(),
p.latLng[1].toFixed(8),
p.latLng[0].toFixed(8),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coords are in reverse order right? points table is sorted lat first, lon second

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I missed that mapbox is using the reversed way. I will resolve that

p.accuracy,
],
})
if (changes === -1) throw new Error(`couldnt insert trajectory: ${message}`)
if (changes === -1) throw new Error(`couldnt insert point: ${message}`)

// update durationDays of trajectory
const {