Skip to content

Commit 75b1a39

Browse files
committed
+ test_srtm_file_to_image
1 parent 1044c08 commit 75b1a39

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

file_to_image.py renamed to test_srtm_file_to_image.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Image as mod_image
44
import ImageDraw as mod_imagedraw
5-
import srtm.retriever as mod_retriever
5+
import srtm as mod_srtm
66

77
def get_color_between(color1, color2, i):
88
""" i is a number between 0 and 1, if 0 then color1, if 1 color2, ... """
@@ -25,7 +25,7 @@ def get_color_between(color1, color2, i):
2525
# Zašto ovo pukne?
2626
#start_latitude, start_longitude = 43.0, 14.0
2727

28-
geo_elevation_data = mod_retriever.get_geo_elevation_data()
28+
geo_elevation_data = mod_srtm.get_data()
2929
geo_file = geo_elevation_data.get_file(start_latitude, start_longitude)
3030

3131
side = geo_file.square_side
@@ -40,9 +40,12 @@ def get_color_between(color1, color2, i):
4040
for column in range(side):
4141
elevation = geo_file.get_elevation_from_row_and_column(row, column)
4242

43-
elevation_coef = elevation / float(max_elevation)
44-
if elevation_coef < 0: elevation_coef = 0
45-
if elevation_coef > 1: elevation_coef = 1
43+
if elevation != None:
44+
elevation_coef = elevation / float(max_elevation)
45+
if elevation_coef < 0: elevation_coef = 0
46+
if elevation_coef > 1: elevation_coef = 1
47+
else:
48+
elevation_coef = ZERO_COLOR
4649

4750
color = get_color_between(MIN_COLOR, MAX_COLOR, elevation_coef)
4851
if elevation <= 0:

0 commit comments

Comments
 (0)