FA-70655 / GIS polygon topology / Member archive
Area-weighted centroid of a multipolygon with holes: edge moment terms · case 05
Centroid x coordinates drift along the edge direction.
Case contract
Input: a multipolygon as a list of polygons, each a list of closed rings (exterior first). Ring orientation is arbitrary: every ring contributes its absolute area and matching first moments, exteriors positively and holes negatively. Moments use the shoelace terms (xi + xi+1)*cross/6. If the total area is 0 return None, else the centroid [cx, cy] rounded to 6 decimals.
Why this case matters
Label placement, zonal summaries and map joins use polygon centroids; courtyards and multi-part parcels must pull the centroid correctly.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control #0 | [6.666667, 5.0] | [5.0, 5.0] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗