twpayne / go-geom

Package geom implements efficient geometry types for geospatial applications.
BSD 2-Clause "Simplified" License
839 stars 104 forks source link

3D polygon area incorrect? #220

Closed chosia closed 1 year ago

chosia commented 1 year ago

Hi there,

I'm trying to use Area() on 3D vertical polygons and the result is 0. I stepped through the code and it seems the Z coordinate is ignored. Is this how it's supposed to be? For example I'm using a poly with the following flat coords: [112,55,2,112,55,5,112,57,4.5,112,57,2,112,55,2], no holes, layout is XYZ. The Area returned is 0.

Thanks, Gosia.

twpayne commented 1 year ago

The github.com/twpayne/go-geom/xy package only supports 2D geometries. For 3D geometries, use the github.com/twpayne/go-geom/xyz package, which is currently only has a few functions implemented. Contributions are of course welcome :)

twpayne commented 1 year ago

To further clarify on this: the methods on geom.T only work in 2D.

twpayne commented 1 year ago

Hopefully this answers your question.