42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
function saveFile(name, data, out) {
|
|
const ret = {
|
|
type: "FeatureCollection",
|
|
name,
|
|
crs: { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
|
|
features: data.map((o) => ({
|
|
type: "Feature",
|
|
properties: o,
|
|
geometry: {
|
|
type: "Point",
|
|
coordinates: [o.lgtd, o.lttd]
|
|
}
|
|
}))
|
|
};
|
|
|
|
fs.writeFileSync(out, JSON.stringify(ret, null, 2), 'utf-8');
|
|
}
|
|
|
|
function main() {
|
|
/*
|
|
const rzraw = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../public/data/rz.json'), 'utf8'));
|
|
|
|
const stcdMap = {};
|
|
rzraw.forEach(o => stcdMap[o.stcd] = true);
|
|
*/
|
|
|
|
let drpraw = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../public/data/drp.json'), 'utf8'));
|
|
//drpraw = drpraw.filter(o => o.type === 'sh' && !stcdMap[o.stcd]);
|
|
|
|
saveFile('drpreal', drpraw, path.resolve(__dirname, '../public/data/drpreal.geojson'));
|
|
|
|
/*
|
|
const skraw = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../public/data/sk.json'), 'utf8'));
|
|
saveFile('skreal', skraw, path.resolve(__dirname, '../public/data/skreal.geojson'));
|
|
*/
|
|
}
|
|
|
|
main();
|