Skip to content

Commit cef8b8f

Browse files
committed
Updated submissions download to show gps coordinates in non-decimal format (Resolves #64)
1 parent b6ccd67 commit cef8b8f

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/api/package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"csv": "^6.2.0",
4343
"dataloader": "^2.1.0",
4444
"date-fns": "^2.29.3",
45+
"dms-conversion": "^3.1.1",
4546
"dotenv": "^16.0.3",
4647
"graphql": "^16.6.0",
4748
"graphql-type-json": "^0.3.2",

src/api/src/http/download-submissions/parse-row/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import {
99
import { HOSTNAME } from '../../../config/index.js'
1010
import parseProgressData from './parse-progress-data/index.js'
1111
import { stringify as stringifySync } from 'csv/sync'
12+
import { parse as parseWkt } from 'wkt'
13+
import dms from 'dms-conversion'
14+
const { default: DmsCoordinates } = dms
1215

1316
const generalVocabularyFields = ['submissionStatus']
1417

@@ -49,6 +52,13 @@ const parseValue = (id, { key, obj, vocabFields, inputFields }) => {
4952
return id
5053
}
5154

55+
if (key === 'xy') {
56+
return parseWkt(value)
57+
.geometries.filter(({ type }) => type?.toLowerCase() === 'point')
58+
.map(({ coordinates: [x, y] }) => new DmsCoordinates(y, x).toString().replace(',', ''))
59+
.join(', ')
60+
}
61+
5262
if (key === 'carbonCredit') {
5363
return `${value}`
5464
}

0 commit comments

Comments
 (0)