This PR resolves a minor bug where the geographic centroid for MultiPolygon features was shown in the dashboard as "NaN, NaN" because the calculateCentroid() function was only set up to handle single Polygon GeoJSON features.
Now, the function (which has been moved to take place server-side, and converted to TypeScript) checks if the incoming coordinates are MultiPolygon (3 dimensional array) versus Polygon (array of array) and applies additional flattening for the former.
This PR resolves a minor bug where the geographic centroid for MultiPolygon features was shown in the dashboard as "NaN, NaN" because the
calculateCentroid()
function was only set up to handle single Polygon GeoJSON features.Now, the function (which has been moved to take place server-side, and converted to TypeScript) checks if the incoming coordinates are MultiPolygon (3 dimensional array) versus Polygon (array of array) and applies additional flattening for the former.