Skip to content

Commit 1419270

Browse files
committed
change back to shapely>=2 in dependencies.txt
1 parent 2dd81b6 commit 1419270

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

dependencies.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ gdal>=3.6.2
22
numpy
33
scipy
44
geopandas
5-
shapely>=2.0.2
5+
shapely>=2
66
networkx
77
owslib
88
loopprojectfile==0.2.2

map2loop/thickness_calculator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import geopandas
2424
import shapely
2525
import math
26-
26+
from shapely.errors import UnsupportedGEOSVersionError
2727

2828
class ThicknessCalculator(ABC):
2929
"""
@@ -365,7 +365,11 @@ def compute(
365365
# calculate the length of the shortest line
366366
line_length = scipy.spatial.distance.euclidean(p1, p2)
367367
# find the indices of the points that are within 5% of the length of the shortest line
368-
indices = shapely.dwithin(short_line, interp_points, line_length * 0.25)
368+
try:
369+
# GEOS 3.10.0+
370+
indices = shapely.dwithin(short_line, interp_points, line_length * 0.25)
371+
except UnsupportedGEOSVersionError:
372+
indices= numpy.array([shapely.distance(short_line[0],point)<= (line_length * 0.25) for point in interp_points])
369373
# get the dip of the points that are within
370374
_dip = numpy.deg2rad(dip[indices])
371375
_dips.append(_dip)

0 commit comments

Comments
 (0)