This commit is contained in:
2025-01-26 19:24:23 -08:00
parent 32cd60e92b
commit d1dde0dbc6
4155 changed files with 29170 additions and 216373 deletions

View File

@@ -2,7 +2,7 @@ import numpy as np
from shapely import lib
from shapely._enum import ParamEnum
from shapely.algorithms._oriented_envelope import _oriented_envelope_min_area
from shapely.algorithms._oriented_envelope import _oriented_envelope_min_area_vectorized
from shapely.decorators import multithreading_enabled, requires_geos
__all__ = [
@@ -412,17 +412,18 @@ def delaunay_triangles(geometry, tolerance=0.0, only_edges=False, **kwargs):
--------
>>> from shapely import GeometryCollection, LineString, MultiPoint, Polygon
>>> points = MultiPoint([(50, 30), (60, 30), (100, 100)])
>>> delaunay_triangles(points)
<GEOMETRYCOLLECTION (POLYGON ((50 30, 60 30, 100 100, 50 30)))>
>>> delaunay_triangles(points).normalize()
<GEOMETRYCOLLECTION (POLYGON ((50 30, 100 100, 60 30, 50 30)))>
>>> delaunay_triangles(points, only_edges=True)
<MULTILINESTRING ((50 30, 100 100), (50 30, 60 30), ...>
>>> delaunay_triangles(MultiPoint([(50, 30), (51, 30), (60, 30), (100, 100)]), \
tolerance=2)
<GEOMETRYCOLLECTION (POLYGON ((50 30, 60 30, 100 100, 50 30)))>
>>> delaunay_triangles(Polygon([(50, 30), (60, 30), (100, 100), (50, 30)]))
<GEOMETRYCOLLECTION (POLYGON ((50 30, 60 30, 100 100, 50 30)))>
>>> delaunay_triangles(LineString([(50, 30), (60, 30), (100, 100)]))
<GEOMETRYCOLLECTION (POLYGON ((50 30, 60 30, 100 100, 50 30)))>
tolerance=2).normalize()
<GEOMETRYCOLLECTION (POLYGON ((50 30, 100 100, 60 30, 50 30)))>
>>> delaunay_triangles(Polygon([(50, 30), (60, 30), (100, 100), (50, 30)]))\
.normalize()
<GEOMETRYCOLLECTION (POLYGON ((50 30, 100 100, 60 30, 50 30)))>
>>> delaunay_triangles(LineString([(50, 30), (60, 30), (100, 100)])).normalize()
<GEOMETRYCOLLECTION (POLYGON ((50 30, 100 100, 60 30, 50 30)))>
>>> delaunay_triangles(GeometryCollection([]))
<GEOMETRYCOLLECTION EMPTY>
"""
@@ -533,11 +534,11 @@ def make_valid(geometry, **kwargs):
@multithreading_enabled
def normalize(geometry, **kwargs):
"""Converts Geometry to normal form (or canonical form).
"""Converts Geometry to strict normal form (or canonical form).
This method orders the coordinates, rings of a polygon and parts of
multi geometries consistently. Typically useful for testing purposes
(for example in combination with ``equals_exact``).
In :ref:`strict canonical form <canonical-form>`, the coordinates, rings of a polygon and
parts of multi geometries are ordered consistently. Typically useful for testing
purposes (for example in combination with ``equals_exact``).
Parameters
----------
@@ -1028,7 +1029,7 @@ def oriented_envelope(geometry, **kwargs):
<POLYGON EMPTY>
"""
if lib.geos_version < (3, 12, 0):
f = _oriented_envelope_min_area
f = _oriented_envelope_min_area_vectorized
else:
f = _oriented_envelope_geos
return f(geometry, **kwargs)