When creating a polygon using the Shapely, I push 4 vertices in the the polygon function. The output should be a tuple with 5 elements (the first vertex is doubled, and described as the last one too).
It seems, however, that the order of the input vertices I pass to the function has impact the result: sometime the polygon is described with 5 vertices (as it should) and sometimes with 4 - meaning, it`s not a closed polygon (or in other words - it is not a polygon at all) It must be some bug.
In the following example, the only difference between poly1 and poly 2 is the order of the vertices I pass. The direction is exactly the same though:
from shapely.geometry import Polygon
print ('poly1 = ', Polygon([(620, 420, 500), (620, 420, 0), (620, 40, 0),(620, 40, 500)]))
print ('poly2 = ',Polygon([(620, 40, 500), (620, 420, 500), (620, 420, 0), (620, 40, 0)]))
However, the result is different - one is a closed polygon, the other is open. The type of both, btw, is still a shapely polygon.
poly1 = POLYGON Z ((620 420 500, 620 420 0, 620 40 0, 620 40 500, 620 420 500))
poly2 = POLYGON Z ((620 40 500, 620 420 500, 620 420 0, 620 40 0))
Any solution?