我尝试使用csvtojson模块创建 GeoJSON 格式的文件,但嵌套根本无法正常工作。谁能指出我正确的方向还是我需要编写自己的代码?
> npx csvtojson input.tsv > output.json
输入.tsv
properties.labelTc properties.labelEn properties.nameTc properties.nameEn properties.zoomifyX properties.zoomifyY geometry.coordinates.1 geometry.coordinates.0 properties.urlEn properties.urlZh type
皇城 The Imperial Palace City 明故宫 Ming Palace 105513 -1863 32.038 118.815 https://en.wikipedia.org/wiki/Ming_Palace Feature
天地壇 Altar of Heaven and Earth Guanghuamen? 105049 -1000 32.058 118.832 https://baike.baidu.com/item/%E5%A4%A9%E5%9D%9B/19964669 Feature
我想要的是
{
"properties": {
"labelTc": "皇城",
"labelEn": "The Imperial Palace City",
...
},
"geometry": {
"coordinates": [118.815, 32.038]
},
"type": "Feature"
}
我得到了什么:
[
{
"properties": {
"labelTc\tproperties": {
"labelEn\tproperties": {
"nameTc\tproperties": {
"nameEn\tproperties": {
"zoomifyX\tproperties": {
"zoomifyY\tgeometry": {
"coordinates": {
"1\tgeometry": {
"coordinates": {
"0\tproperties": {
"urlEn\tproperties": {
"urlZh\ttype": "??\tThe Imperial Palace City\t???\tMing Palace\t105513\t-1863\t32.038\t118.815\thttps://en.wikipedia.org/wiki/Ming_Palace\t\tFeature"
}
}
}
}
}
}
}
}
}
}
}
}
},