Skip to content
Open
Changes from all commits
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: 5 additions & 6 deletions functions/src/export-geojson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import * as functions from 'firebase-functions';
import {Map} from 'immutable';
import {canExport, hasOrganizerRole} from './common/auth';
import {getDatastore} from './common/context';
import {isAccessibleLoi} from './common/utils';
Expand Down Expand Up @@ -128,7 +127,7 @@ function buildFeature(loi: Pb.LocationOfInterest) {
}
return {
type: 'Feature',
properties: propertiesPbToModel(loi.properties).toObject(),
properties: propertiesPbToObject(loi.properties),
geometry: toGeoJsonGeometry(loi.geometry),
};
}
Expand All @@ -142,15 +141,15 @@ function getFileName(jobName: string | null) {
return `${fileBase}.geojson`;
}

function propertiesPbToModel(pb: {
function propertiesPbToObject(pb: {
[k: string]: Pb.LocationOfInterest.IProperty;
}): Map<string, string | number> {
}): {[k: string]: string | number} {
const properties: {[k: string]: string | number} = {};
for (const k of Object.keys(pb)) {
for (const k of Object.keys(pb).sort()) {
const v = pb[k].stringValue || pb[k].numericValue;
if (v !== null && v !== undefined) {
properties[k] = v;
}
}
return Map(properties);
return properties;
}
Loading