From 05720799e39584c99236c31088c36b69f40abc43 Mon Sep 17 00:00:00 2001 From: cnouguier Date: Thu, 18 Nov 2021 01:57:08 +0100 Subject: [PATCH] feat: handle bbox in geojson --- capture.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/capture.js b/capture.js index 4068ad3..0fa3aff 100644 --- a/capture.js +++ b/capture.js @@ -115,14 +115,14 @@ async function getLayerCategoryId (page, layerId) { } // Process the features if (parameters.features) { - const collection = JSON.stringify({ + let geoJson = { type: 'FeatureCollection', features: parameters.features - }) - writeTmpFile(tmpGeoJsonFile, collection) - const loaderSelector = '#dropFileInput' + } + if (parameters.bbox) geoJson.bbox = parameters.bbox + writeTmpFile(tmpGeoJsonFile, JSON.stringify(geoJson)) try { - const loader = await page.$(loaderSelector) + const loader = await page.$('#dropFileInput') await loader.uploadFile(path.join(tmpDir, tmpGeoJsonFile)) } catch (error) { console.error(`Upload features file failed: ${error}`)