You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having trouble with getting the data for turf.centerOfMass() correct.
I have a featureCollection which can have multiple polygons added to it.
var polygonlines = [];
//add lines to polygons etc..
if (polygonlines.length >= 4) {
var feature =
{
"type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [polygonlines] }
}
features.push(feature);
}
}
});
}
var featCollection = {
type: 'FeatureCollection',
features: features
}
I want to calculate the centroid, center and the centerOfMass.
var centroid = turf.centroid(featCollection); //WORKS CORRECTLY
var centre = turf.center(featCollection); //WORKS CORRECTLY
var centreofMass = turf.centerOfMass(featCollection); //FAILS
The centerOfMass calculation fails and give me the error: "Uncaught TypeError TypeError: Qt is not a constructor"
The only way i can get centerOfMass to not fail is to list an individual polygon from the featcollection... but this is not what i want, i want the centerOfMass for multiple polygons. The turf documentation says centre and centerOfMass can take any Feature or a FeatureCollection, centre and centroid do and they work fine...
How do I get it to get the centerOfMass for multiple polygons?
Thank you very much
Version 5.6.0
The text was updated successfully, but these errors were encountered:
I can repeat the problem with lots of different polygons, the problem is not unique to just this one.
Thank you.
Error message (if it helps):
Uncaught TypeError TypeError: Qt is not a constructor
at ne (C:\Dev\xx\trunk\xx\wwwroot\js\turf.min.js:39:20359)
at ve (C:\Dev\xx\trunk\x\wwwroot\js\turf.min.js:39:24423)
at t (C:\Dev\xx\trunk\xx\wwwroot\js\turf.min.js:155:394937)
at calculateGroupCentreAndRadius (localhost?5001/?dataset=a8e60383-c8b1-4668-b00f-b6354076863a?490:9:234668:24)
at (localhost?5001/?dataset=a8e60383-c8b1-4668-b00f-b6354076863a?490:9:232642:9)
at dispatch (C:\Dev\xx\trunk\xx\wwwroot\lib\jquery\dist\jquery.min.js:2:43331)
at y.handle (C:\Dev\xx\trunk\xx\wwwroot\lib\jquery\dist\jquery.min.js:2:41315)
at trigger (C:\Dev\xx\trunk\xx\wwwroot\lib\jquery\dist\jquery.min.js:2:71937)
at triggerHandler (C:\Dev\xx\trunk\xx\wwwroot\lib\jquery\dist\jquery.min.js:2:72616)
at checkboxChange (C:\Dev\xx\trunk\xx\wwwroot\js\gijgo.min.js:1:109130)
at change (C:\Dev\xx\trunk\xx\wwwroot\js\gijgo.min.js:1:106987)
at dispatch (C:\Dev\xx\trunk\xx\wwwroot\lib\jquery\dist\jquery.min.js:2:43331)
at y.handle (C:\Dev\xx\trunk\xx\wwwroot\lib\jquery\dist\jquery.min.js:2:41315)
I am having trouble with getting the data for turf.centerOfMass() correct.
I have a featureCollection which can have multiple polygons added to it.
I want to calculate the centroid, center and the centerOfMass.
The centerOfMass calculation fails and give me the error: "Uncaught TypeError TypeError: Qt is not a constructor"
The only way i can get centerOfMass to not fail is to list an individual polygon from the featcollection... but this is not what i want, i want the centerOfMass for multiple polygons. The turf documentation says centre and centerOfMass can take any Feature or a FeatureCollection, centre and centroid do and they work fine...
How do I get it to get the centerOfMass for multiple polygons?
Thank you very much
Version 5.6.0
The text was updated successfully, but these errors were encountered: