shpjs将.zip文件转成geoJson
一、npm install shpjs
二、import shp from shpjs
三、
async setLayerSource() {
const geoJsonData = await shp(dataUrl)
}
一直报错:是因为Buffer这个插件一直没找到
Uncaught Error: nodebuffer is not supported by this browser
解决办法
npm install node-polyfill-webpack-plugin
vue.config.js
const NodePolyfillPlugin = require(node-polyfill-webpack-plugin)
module.exports = {
configureWebpack: (config) => {
config.plugins.push(new NodePolyfillPlugin())
}
}
一、npm install shpjs 二、import shp from shpjs 三、 async setLayerSource() { const geoJsonData = await shp(dataUrl) } 一直报错:是因为Buffer这个插件一直没找到 Uncaught Error: nodebuffer is not supported by this browser 解决办法 npm install node-polyfill-webpack-plugin vue.config.js const NodePolyfillPlugin = require(node-polyfill-webpack-plugin) module.exports = { configureWebpack: (config) => { config.plugins.push(new NodePolyfillPlugin()) } }