Created
April 11, 2019 03:19
-
-
Save zmofei/5b940e83a13b08e3b42e1305f64f221d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const _get = JSON.parse(fs.readFileSync('./china.geojson')); | |
const geo = _get.coordinates[0] | |
// console.log(geo) | |
const cache = new Set(); | |
let newC = []; | |
geo.forEach(v => { | |
let name = `${v[0]},${v[1]}`; | |
if (cache.has(name)) { | |
// count++; | |
console.log(name); | |
} else { | |
newC.push(v); | |
cache.add(name, v); | |
} | |
}) | |
_get.coordinates[0] = newC; | |
fs.writeFileSync('./china_after.geojson', JSON.stringify(_get)); | |
// cache.forEach((k, v) => { | |
// console.log(v) | |
// }) | |
// console.log(count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment