TST: update maximum_inscribed_circle tests for latest GEOS changes#2294
Conversation
|
The import matplotlib.pyplot as plt
import shapely
from shapely.plotting import plot_polygon, plot_line
polygon = shapely.Polygon(
[
(32.71997, -117.19310),
(32.71997, -117.21065),
(32.72408, -117.21065),
(32.72408, -117.19310),
]
)
result = shapely.maximum_inscribed_circle(polygon)
fig, ax = plt.subplots()
plot_polygon(polygon, ax=ax)
plot_line(shapely.maximum_inscribed_circle(polygon), ax=ax, color="C1") |
|
Actually, the images are misleading because I was not using equal aspect ratio .. Plotting this again, you can see that both results are strictly correct (they give the same size of circle). It's only that for the purpose of "polylabel", the more centered circle might give a better result. Updated codeWith GEOS 3.13.0: With GEOS 3.14.dev main: |
|
I agree with the upstream assessment that this is a "won't fix" since the input has a non-deterministic result. The input should be changed to yield a deterministic result. $ pixi exec -s geos=3.10.1 geosop -f wkt -a "POLYGON ((100 0, 200 200, 300 200, 300 100, 100 0))" maxInscribedCircle 0.0001
LINESTRING (238.19656372070312 138.19656372070312, 182.91793823242188 165.83587646484375)
$ pixi exec -s geos=3.13.1 geosop -f wkt -a "POLYGON ((100 0, 200 200, 300 200, 300 100, 100 0))" maxInscribedCircle 0.0001
LINESTRING (238.19656372070312 138.19656372070312, 182.91793823242188 165.83587646484375) |
Then we can also just remove the test, since it was added specifically for this rectangle corner case (#644) |
|
Going to merge this already to have green CI on main, but happy to follow-up with either updating or removing the test |




Some tests are failing on the GEOS main builds (eg https://github.com/shapely/shapely/actions/runs/14814815121/job/41593981112), related to some recent commits in GEOS (libgeos/geos@4ae3f05...6f4a739)