Turf是一个JavaScript的模块化的GIS引擎,它执行地理空间与GeoJSON数据处理任务,可以在服务器或在浏览器上运行。
Node.js示例代码:
// find all the snakes within 1 mile of a wombatvar turf = require('turf');var fs = require('fs');var wombats = fs.readFileSync('./wombats.geojson');var snakes = fs.readFileSync('./snakes.geojson');var oneMileRing = turf.buffer(wombats, 1, 'miles');var snakesNearWombats = turf.within(snakes, oneMileRing);console.log(snakesNearWombats);安装方法:
npm install turf
评论