Skip to content

Commit

Permalink
fix NaN for z dimension in buffer output
Browse files Browse the repository at this point in the history
  • Loading branch information
Ylannl committed Sep 24, 2020
1 parent c653fb0 commit 994e47a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions geos_nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ namespace geoflow::nodes::gfp_geos {

template<typename T> void from_geos_linear_ring(const GEOSGeometry* g_lin_ring, T& gf_ring) {
const GEOSCoordSequence* g_coord_seq = GEOSGeom_getCoordSeq_r(gc, g_lin_ring);
unsigned int size;
unsigned int size, dims;
GEOSCoordSeq_getSize_r(gc, g_coord_seq, &size);
GEOSCoordSeq_getDimensions_r(gc, g_coord_seq, &dims);

// note we do not repeat the first coordinate
for (size_t i = 0; i < (size-1); ++i) {
double x, y, z = 0;
GEOSCoordSeq_getX_r(gc, g_coord_seq, i, &x);
GEOSCoordSeq_getY_r(gc, g_coord_seq, i, &y);
GEOSCoordSeq_getZ_r(gc, g_coord_seq, i, &z);
if (dims==3) GEOSCoordSeq_getZ_r(gc, g_coord_seq, i, &z);
gf_ring.push_back({float(x),float(y),float(z)});
}
}
Expand Down

0 comments on commit 994e47a

Please sign in to comment.