node-mapnik icon indicating copy to clipboard operation
node-mapnik copied to clipboard

Shapefile Read Fails with NodeJS 18 but works with NodeJS 16

Open crh3675 opened this issue 2 years ago • 1 comments

Using the example on the main page:

var mapnik = require('mapnik');
mapnik.register_datasource(path.join(mapnik.settings.paths.input_plugins,'shape.input'));
var ds = new mapnik.Datasource({type:'shape',file:'test/data/world_merc.shp'});
var featureset = ds.featureset()
var geojson = {
  "type": "FeatureCollection",
  "features": [
  ]
}
var feat = featureset.next();
while (feat) {
    geojson.features.push(JSON.parse(feat.toJSON()));
    feat = featureset.next();
}
fs.writeFileSync("output.geojson",JSON.stringify(geojson,null,2));

This fails with NodeJS 18:

Mapnik LOG> 2023-10-20 16:50:49: Shape Plugin: error processing field attributes, Shape Plugin: wrong file code -1532402325

crh3675 avatar Oct 20 '23 16:10 crh3675

Related but for another project https://github.com/ZJONSSON/node-unzipper/issues/286. And https://github.com/nodejs/node/commit/654b7474e38e9a6272b73586023848109cfe358c

crh3675 avatar Oct 24 '23 13:10 crh3675

Just checked (master) works with

lts/hydrogen -> v18.20.2 lts/iron -> v20.12.2

Closing as stale

artemp avatar Apr 24 '24 14:04 artemp