0
我想知道如果我有一个GeoJSON的对象,如如何保存以GeoJSON到文件使用JavaScript
var geoJSONLoc= {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"timeReported": "2013-01-22 08:42:26+01"
},
"geometry": {
"type": "Point",
"coordinates": [
7.582512743,
51.933292258,
1
]
}
},
{
"type": "Feature",
"properties": {
"timeReported": "2013-01-22 10:00:26+01"
},
"geometry": {
"type": "Point",
"coordinates": [
7.602516645,
51.94962073,
1
]
}
}]}
我如何保存这为未来使用以.json文件?
我想使用
localStorage.setItem('geoJSONLoc.json', geoJSONLoc);
但它不似乎是正确的答案。
您在浏览器或节点?如果你是在浏览器中,你只能保存/从磁盘负载通过用户提示和文件对话框 –
我用的NodeJS,并试图保存价值,所以我可以把它用于以后 – Tenz
好,我添加节点标签,这改变了相当多的问题 –