mapbox / shp-write

create and write to shapefiles in pure javascript
BSD 3-Clause "New" or "Revised" License
290 stars 186 forks source link

Support of 3D Polygon and LineString #111

Open nnvvijay opened 8 months ago

nnvvijay commented 8 months ago

Hi, Looks like I am not able to convert 3D polygon and LineString to shp file.

const coordinates = [ [ [0, 0, 0], // Vertex 1: x, y, z [0, 10, 0], // Vertex 2: x, y, z [10, 10, 0],// Vertex 3: x, y, z [10, 0, 0], // Vertex 4: x, y, z [0, 0, 0] // Closing vertex to complete the polygon ] ];

After conversion, I am getting only X and Y values, not Z values. Is this supported?

--Vijay

sheindel commented 8 months ago

Hello Vijay,

Right now this is not supported by this library. There is a PR out that attempts to deal with this but I have not made time to review it yet. My time to support this library is limited and so I can mainly only support my use case which is for 2d shapefiles. If you want to look at the 3D PR and add any comments or tests that might be helpful, I will see if I can integrate it.

nnvvijay commented 8 months ago

Hi, Thanks for your quick response. Yes, I am interested in validating and testing it as I need a 3D polyline in my project. Please see the details about how to use this.

--Vijay

sheindel commented 8 months ago

The two PRs that deal with 3D objects are

https://github.com/mapbox/shp-write/pull/55 https://github.com/mapbox/shp-write/pull/60

Feel free to try one of these out and post any testing results in a new PR