Search code examples
javascriptnode.jsshapefile

how to read shapeFile Attribute (access Attribute Table) in Node.Js


I am using Node.js and https://www.npmjs.com/package/shapefile package to read Shape file but my code only read the coordinates of Geo shapes shape file . i want to have access to attribute of my Shape file how can i solve this problem ??

const shapefile = require("shapefile");

let MyData =[];
shapefile.open(addr)
        .then(source => source.read()
          .then(function log(result) {
            if (result.done) return;
            console.log(result);
            MyData.push(result.value);
            return source.read().then(log);
          }))
        .catch(error => console.error(error.stack))
        .then(()=>{
          res.send(MyData);
        });

Solution

  • If you mean attributes that you can see in ARCGIS software, you should read .dbf files for that purpose you can use dbf-reader package