Python shapely: .equals function does not always work:
<p>I am having a few issues with the shapely library.
Now the equals function seem not to always work:</p>

<pre><code>poly1 =  Polygon(([220.0, 400, 500], [220.0, 20, 500], [220.0, 20, 0], [220.0, 400, 0], [220.0, 400, 500]))
poly2 =  Polygon(([220.0, 20, 500], [220.0, 400, 500], [220.0, 400, 0], [220.0, 20, 0], [220.0, 20, 500]))

print (poly1.equals(poly2))
</code></pre>

<p>Results with a false.
Any idea  why?</p>

<p>From docs:</p>

<blockquote>
  <p>The Polygon constructor takes two positional parameters. The first is an ordered sequence of (x, y[, z]) point tuples and is treated exactly as in the LinearRing case.</p>
</blockquote>

<p>So try to sort them first (tuples) before create <code>Polygon</code>:</p>

<pre><code>&gt;&gt;&gt; pol1_coords = ([0, 1, 2], [3, 4, 5], [6, 7, 8])
&gt;&gt;&gt; pol2_coords = ([0, 1, 2], [6, 7, 8], [3, 4, 5])
&gt;&gt;&gt; Polygon(sorted(pol1_coords)) == Polygon(sorted(pol2_coords))
True
</code></pre>

<p>instead you'll still have this issue:</p>

<pre><code>&gt;&gt;&gt; Polygon(pol1_coords) == Polygon(pol2_coords)
False
</code></pre>

python shapely