shapely is_valid for polygons in 3D
<p>I'm trying to validate some polygons that are on planes with <code>is_valid</code>, but I get  <code>Too few points in geometry component at or near point</code> for polygons where the z is not constant.</p>

<p>Is there a way to validate these other polygons?</p>

<p>Here's an example:</p>

<pre><code>from shapely.geometry import Polygon


poly1 = Polygon([(0,0), (1,1), (1,0)])
print(poly1.is_valid)
# True

# z=1
poly2 = Polygon([(0,0,1), (1,1,1), (1,0,1)])
print(poly2.is_valid)
# True

# x=1
poly3 = Polygon([(1,0,0), (1,1,1), (1,1,0)])
print(poly3.is_valid) 
# Too few points in geometry component at or near point 1 0 0
# False
</code></pre>

<p>The problem is that <code>shapely</code> in fact ignores the z coordinate. So, as far as shapely can tell you are building a polygon with the points <code>[(1,0),(1,1), (1,1)]</code> that aren't enough to build a polygon.</p>

<p>See this other SO question for more information: <a href="http://stackoverflow.com/questions/39317261/python-polygon-does-not-close-shapely/39347117#39347117">python-polygon-does-not-close-shapely</a>.</p>

<p>IMHO, shapely shouldn't allow three dimension coordinates, because it brings this kind of confusions. </p>

python gis shapely