Skip to content

Commit de5906f

Browse files
authored
Add expected format to "Import GeoJSON" dialog (#2532)
1 parent 66a2c06 commit de5906f

4 files changed

Lines changed: 24 additions & 6 deletions

File tree

functions/src/import-geojson.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function importGeoJsonCallback(
101101
}
102102
})
103103
.on('data', (data: any) => {
104-
if (!hasError) onGeoJsonFeature(data, surveyId, jobId);
104+
if (!hasError) onGeoJsonFeature(data, jobId);
105105
})
106106
);
107107
} catch (err) {
@@ -187,11 +187,7 @@ export function importGeoJsonCallback(
187187
* GeoJSON Feature objects within the file. It checks the feature type, geometry
188188
* validity, and converts the feature to a document data format for insertion.
189189
*/
190-
function onGeoJsonFeature(
191-
geoJsonFeature: any,
192-
surveyId: string,
193-
jobId: string
194-
) {
190+
function onGeoJsonFeature(geoJsonFeature: any, jobId: string) {
195191
if (geoJsonFeature.type !== 'Feature') {
196192
console.debug(
197193
`Skipping Feature with invalid type ${geoJsonFeature.type}`

web/src/app/components/shared/import-dialog/import-dialog.component.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ <h2 mat-dialog-title>
3333
>
3434
</h2>
3535
<mat-dialog-content>
36+
<p
37+
class="format-description"
38+
i18n="@@app.dialogs.importSites.formatDescription"
39+
>
40+
Upload a GeoJSON <code>FeatureCollection</code>. Coordinates must use the
41+
WGS84 (CRS84) coordinate reference system, the only projection currently
42+
supported. Each feature's <code>name</code> property sets the site name,
43+
and the feature's top-level <code>id</code> sets the site ID.
44+
</p>
3645
<form [formGroup]="uploadForm">
3746
<div>
3847
<file-upload

web/src/app/components/shared/import-dialog/import-dialog.component.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ file-upload {
1818
width: 300px;
1919
}
2020

21+
.format-description {
22+
max-width: 300px;
23+
margin: 0 0 16px;
24+
font-size: 14px;
25+
line-height: 1.4;
26+
color: rgba(0, 0, 0, 0.6);
27+
28+
code {
29+
font-family: monospace;
30+
}
31+
}
32+
2133
.spinner {
2234
margin: 0px auto;
2335
}

web/src/locale/messages.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
"app.labels.termsOfService": "Terms of service",
117117
"app.dialogs.importSites.importingSites": "Importing sites...",
118118
"app.dialogs.importSites.title": "Import data collection sites (.geojson)",
119+
"app.dialogs.importSites.formatDescription": " Upload a GeoJSON {$START_TAG_CODE}FeatureCollection{$CLOSE_TAG_CODE}. Coordinates must use the WGS84 (CRS84) coordinate reference system, the only projection currently supported. Each feature's {$START_TAG_CODE}name{$CLOSE_TAG_CODE} property sets the site name, and the feature's top-level {$START_TAG_CODE}id{$CLOSE_TAG_CODE} sets the site ID. ",
119120
"app.labels.upload": "Upload",
120121
"app.labels.downloadCsv": "Download job data (CSV)",
121122
"app.labels.downloadGeojson": "Download site locations (GeoJSON)",

0 commit comments

Comments
 (0)