背景
利用gdal读取shp数据中每个feature的各个字段,然后存到一个json文件下
解决办法
let filePathPhoto = path.resolve('./photo');
let filePathShp = path.resolve('./shp');
let dataset = gdal.open(shppath);
let sheets = xlsx.parse(excelpath);
let layer = dataset.layers.get(0);
let feature;
while (feature = layer.features.next()) {
feature.fields.forEach(function(value, key) {
});
}
当然具体直接看node-gdal官网就行 http://naturalatlas.github.io/node-gdal/classes/gdal.Layer.html
源代码
如果你觉得有用,就请点个关注哈!下面附上我个人微信公众号以及bilibili站台号,有兴趣的朋友可以加入我的们技术交流群,不定期分享免费的、高质量的编程课程,还有内部机会哦!期待你的加入!
bilibili UP主:程序军火库&&程序狙击手