-1
from shapely.geometry import Polygon, MultiPolygon, mapping
from shapely.ops import cascaded_union

polygon = Polygon([(0,0), (0, 1), (1, 1), (1, 2)])
polygon.is_simple

gives True. But the description/documentation is:

True if the geometry is simple, meaning that any self-intersections are only at boundary points, else False

I thought this was one of the cases that are not simple. Could you please give me a minimal example of a non-simple polygon?

Martin Thoma
  • 124,992
  • 159
  • 614
  • 958

1 Answers1

0

Your polygon is not valid (the definition of not valid depends on the geometry type), but it is simple. To be honest, I think that once the geometry is not valid, I don't know if it is possible to define whether or not the geometry is simple. Because, if it is not valid, how would you define the boundary and the interior of the geometry?

To give you an example of a not simple geometry, try the same points but with a LineString:

l = LineString([(0, 0), (0, 1), (1, 1), (1, 2), (0, 0)])

In this case, since it is a geometry of one dimension, the boundary is composed of the two ending points. The interior are the lines, and it self-intersects in this. Thus, this geometry is valid, but it is not simple.

eguaio
  • 3,754
  • 1
  • 24
  • 38