multipolygon bug
See original GitHub issueI think there is a bug with multipolygon shapes, I started from example/test_multiple_poly.js Open the generated shape in qgis you will see that there is a problem… Is there something wrong in my code ?
var write = require('shp-write').write,
    fs = require('fs');
var features = [];
var points = [];
for (var i=0; i<3; i++) {
  features.push({id: i});
  points.push([[i, 0], [i, 1], [i+1, 1], [i+1, 0], [i, 0]]);
};
console.log(features);
console.log(points);
function finish(err, files) {
    fs.writeFileSync('polygon.shp', toBuffer(files.shp.buffer));
    fs.writeFileSync('polygon.shx', toBuffer(files.shx.buffer));
    fs.writeFileSync('polygon.dbf', toBuffer(files.dbf.buffer));
    fs.writeFileSync('polygon.prj', files.prj);
}
function toBuffer(ab) {
    var buffer = new Buffer(ab.byteLength),
        view = new Uint8Array(ab);
    for (var i = 0; i < buffer.length; ++i) { buffer[i] = view[i]; }
    return buffer;
}
write(
    // feature data
    features,
    // geometry type
    'POLYGON',
    // geometries
    points,
    finish);
Issue Analytics
- State:
 - Created 9 years ago
 - Comments:15 (2 by maintainers)
 
Top Results From Across the Web
Error validating geometry collection / multipolygon in PostGIS
I have just updated a table of polygons with a query which returned: UPDATE parcel SET wkb_geometry = ST_Multi(wkb_geometry) UPDATE 399212 Query ...
Read more >Bug report #7555: Postgis Multipolygon Errors
Severe known bugs when using merge or clip tools that create POLYGON and not MULTIPOLYGON. Related issues. Duplicates QGIS Application - Bug report...
Read more >Invalid MultiPolygon value even though all the Polygons are ...
I am trying to convert coordinates to WKT format. Here I have a list of polygons which should be identified as a Multi...
Read more >Possible bug plotting MultiPolygons in scattermapbox?
In scattermapbox it seems to be only plotting the outer lines and filling in the entire polygon, compared to the plot on github...
Read more >ERROR: Geometry type (MultiPolygon) does not match ...
Warning 1: Geometry to be inserted is of type 3D Multi Polygon, whereas the layer geometry type is 3D Polygon. Insertion is likely...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @gxcodes, I added an example to create a shape using node-gdal https://github.com/naturalatlas/node-gdal/pull/205/commits/870b44b45075f41f7eae325b077392f5bada1aa5
Thanks for the link, will definitely check it out. Hopefully it doesn’t need any native dependencies as I’m developing a multi-platform app with electron.