Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What answers does method "is_valid_reason" from shapely return?

Tags:

python

shapely

What answers does method "is_valid_reason" from shapely return?

Now I know several types of answers:

  • Valid Geometry
  • Self-intersection
  • Nested shells
  • Ring Self-intersection

But where can I see the full list of answers? Maybe there is another reason for the invalidity?

like image 945
Артём Белов Avatar asked Feb 03 '26 15:02

Артём Белов


1 Answers

Shapely uses functions from GEOS (that is derived from JTS, a Java project).

So, the exhaustive list of values returned by is_valid_reason should be the same (or equivalent) as the values of the errors' messages in the TopologyValidationError class (see docs):

public static final String[] errMsg = {
  "Topology Validation Error",
  "Repeated Point",
  "Hole lies outside shell",
  "Holes are nested",
  "Interior is disconnected",
  "Self-intersection",
  "Ring Self-intersection",
  "Nested shells",
  "Duplicate Rings",
  "Too few distinct points in geometry component",
  "Invalid Coordinate",
  "Ring is not closed"
};
like image 72
Timeless Avatar answered Feb 06 '26 05:02

Timeless