Closed jerluc closed 5 years ago
I think I may have found the root of the issue, creating a PR now!
This was fixed a month about via https://github.com/paulmach/orb/pull/16 and https://github.com/paulmach/orb/commit/f3ee61f36a55c286ab302585a71ecefaac5661f5
Observed
For geometries with holes, the
planar.CentroidArea()
function is returning incorrect centroids (the planar area returned is correct though).To reproduce
Note that this bug has been observed on other geometries, but this is the one I've chosen as an example:
Running this code produces the following output:
Expected
Using other tools (in this case, shapely) produces the following, which can be visually verified as being correct/expected:
Possible causes
One bit of code I ran into while trying to debug is in the implementation for
planar.CentroidArea()
. I have read in some other implementations (namely libgeos) that they use the "signed" area, rather than the absolute value, as orb uses here. I'm not 100% sure that this is the cause, but wanted to ask about this logic.