node-mapnik
node-mapnik copied to clipboard
Shapefile Read Fails with NodeJS 18 but works with NodeJS 16
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
Related but for another project https://github.com/ZJONSSON/node-unzipper/issues/286. And https://github.com/nodejs/node/commit/654b7474e38e9a6272b73586023848109cfe358c
Just checked (master) works with
lts/hydrogen -> v18.20.2
lts/iron -> v20.12.2
Closing as stale