From b6dedf92e313524e5cb930a5c58f5b567e2ed7b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Tue, 4 Dec 2018 21:37:36 +0100 Subject: [PATCH] exportAll/GeoJSON: when exporting single object, don't wrap in FeatureCollection --- src/ExportGeoJSON.js | 8 +++++--- src/exportAll.js | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ExportGeoJSON.js b/src/ExportGeoJSON.js index 7f317c04..c1f2ca12 100644 --- a/src/ExportGeoJSON.js +++ b/src/ExportGeoJSON.js @@ -16,9 +16,11 @@ class ExportGeoJSON { } finish (list) { - list = { - type: 'FeatureCollection', - features: list + if (!this.conf.singleFeature) { + list = { + type: 'FeatureCollection', + features: list + } } return { diff --git a/src/exportAll.js b/src/exportAll.js index f9d7d36a..127983fe 100644 --- a/src/exportAll.js +++ b/src/exportAll.js @@ -137,6 +137,9 @@ module.exports = (data, div) => { submit.style.display = 'none' let conf = formExport.get_data() + + conf.singleFeature = true + createDownload(conf, [ data ], (err) => { if (err) { alert(err)