Node.js geojson中的turf和unkink多边形

Node.js geojson中的turf和unkink多边形,node.js,command-line,geojson,turfjs,Node.js,Command Line,Geojson,Turfjs,我正在尝试从geojson文件中自动删除自交集 我不太熟悉如何设置IO。我正在尝试修复的文件位于此处: 我正在尝试: const fname="ks_kansas_zip_codes_geo.min.json"; const fout="fixed_kansas.json"; const turf = require('@turf/turf'); const fs = require('fs'); var tmp = fs.readFile(fname, function(err, x)

我正在尝试从geojson文件中自动删除自交集

我不太熟悉如何设置IO。我正在尝试修复的文件位于此处:

我正在尝试:

const fname="ks_kansas_zip_codes_geo.min.json";
const fout="fixed_kansas.json";
const turf = require('@turf/turf');
const fs = require('fs');
var tmp = fs.readFile(fname, function(err, x) {
   var fixed = turf.unkinkPolygon(turf.polygon(x));
   console.log(fixed);
   return(fixed)
  });
// fs.writeFileSync(fout, tmp);
我得到的错误是:

Error: coordinates is required
   at polygon (/home/username/node_modules/@turf/helpers/main.js:229:29)
undefined
> { type: 'FeatureCollection', features: [] }

> tmp
undefined

我得到的错误是:

Error: coordinates is required
   at polygon (/home/username/node_modules/@turf/helpers/main.js:229:29)
undefined
> { type: 'FeatureCollection', features: [] }

> tmp
undefined
不确定如何使用此库对geojson文件进行操作。我看到了很多,但是没有任何端到端的东西可以帮助我加载它,这样我就可以制作我想要的东西,这更像是:

node myscript.js ks_kansas_zip_codes_geo.min.json fixed_ks.json

你解决问题了吗?如果是,你可以分享你的经历。不,我没有决心。