Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cddf7ec

Browse files
committed
neighbour with elevation == None for approximation fixed
1 parent ffeaa6b commit cddf7ec

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

srtm/data.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,15 @@ def approximation(self, latitude, longitude):
273273
# TODO(TK) Check if coordinates inside the same file, and only the decide if to xall
274274
# self.geo_elevation_data.get_elevation or just self.get_elevation
275275

276+
if elevation_1 == None or elevation_2 == None or elevation_3 == None or elevation_4 == None:
277+
elevation = self.get_elevation(latitude, longitude, approximate=False)
278+
if not elevation:
279+
return None
280+
elevation_1 = elevation_1 or elevation
281+
elevation_2 = elevation_2 or elevation
282+
elevation_3 = elevation_3 or elevation
283+
elevation_4 = elevation_4 or elevation
284+
276285
# Normalize importance:
277286
sum_importances = float(importance_1 + importance_2 + importance_3 + importance_4)
278287

0 commit comments

Comments
 (0)