解析 shapfile 文件需要用到一个插件。
安装
npm i shapefile
使用
import {open} from 'shapefile'
open(shpfile, dbffile, {
// 编码方式
encoding: 'GBK'
})
.then(source => source.read()
.then(function log (result) {
if (result.done) {
// 执行完毕的方法
// ...
return
}
return source.read().then(log)
})
)
.catch(error => console.error(error.stack))
文档地址
(shapefile 文件解析)[]