Skip to content
Advertisement

How to calculate the center of gravity with shapely in python?

I discovered shapely but I did not find how to calculated the center of gravity of a polygon!

Does someone have the solution?

Advertisement

Answer

If your polygon has a uniform density, its center of mass coincides with its centroid. In shapely, the centroid can be directly calculated as:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement