diff --git a/Development/server/helpers/gridline_util.js b/Development/server/helpers/gridline_util.js index e9971b0..f9669a7 100644 --- a/Development/server/helpers/gridline_util.js +++ b/Development/server/helpers/gridline_util.js @@ -99,7 +99,15 @@ async function getLinesLatLng(job, sprayIds, halfSwathOffset = true, x, y, headi // Convert line buffers to xcl zones then also include them within the next process if (bufs && bufs.length) { for (let i = 0; i < bufs.length; i++) { - const polyCoors = bufUtil.lineBuffer(bufs[i].geometry.coordinates, utils.toMeter(bufs[i].properties.width, job.measureUnit)); + const geoType = bufs[i].geometry.type; + let polyCoors; + if (geoType === 'Polygon') { + // Edge buffers and feature buffers are already polygons — use the outer ring directly + polyCoors = bufs[i].geometry.coordinates[0]; + } else { + // Segment/corridor buffers are LineStrings — expand to polygon using corridor width + polyCoors = bufUtil.lineBuffer(bufs[i].geometry.coordinates, utils.toMeter(bufs[i].properties.width, job.measureUnit)); + } if (!utils.isEmptyArray(polyCoors)) { xclZones.push(jobUtil.createXclArea({ name: `XCL${i + 1}`, coors: polyCoors })); }