我尝试使用shpjs包导入形状文件传单Map的基础上shpjs文档:shpjs
下面是我的代码:
const [geoData, setGeoData] = useState(null); //state
//onChange function
const onChangeFile = ({ target }) => {
var reader = new FileReader();
var file = target.files[0];
reader.readAsArrayBuffer(file);
reader.onload = function (buffer) {
setGeoData(buffer.target.result);
};
};
然后我使用shpjs包如下:
const geoJson = await shp(geoData)
导入www.example.com后shp.zip,我得到此错误:
我该怎么解决这个问题?
1条答案
按热度按时间rqdpfwrv1#
你可以使用npm包
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
和在react节点模块配置文件和webpackconfig中添加包以上refer this link jay patel作者