hypothesis-geojson
hypothesis-geojson copied to clipboard
geometry validity
It would be nice to (optionally?) assert that the geometries are valid with correct winding order, etc.
A potential implementation
def validate_ring(coords):
from shapely.geometry import shape, mapping
from shapely.geometry.polygon import orient
poly = shape({'type': 'Polygon', 'coordinates': [coords]})
poly2 = poly.buffer(0)
if poly2.type == 'MultiPolygon':
poly2 = poly2.geoms[0]
ring = mapping(orient(poly2).exterior)['coordinates']
return list(ring)
Is there any way to achieve this without a Shapely
dependency?