Fixed critical issue at which all natural:water was removed, which does not need to be the case for all orthos. Implemented new mechanism to check against existence of an empty file to selectively run the water removal mechanism.
This commit is contained in:
parent
8f08b3dfb3
commit
b3d5fca112
98
photogen.py
98
photogen.py
@ -531,59 +531,61 @@ class mstr_photogen:
|
||||
# At ZL16 there seems to be an issue with water bodies, especially rivers (natural:water).
|
||||
# Let's see if we can correct that
|
||||
|
||||
# natural:water
|
||||
ntrl_water = False
|
||||
ntrl_idx = 0
|
||||
for lyr in self._lyrnames:
|
||||
if lyr[0] == "natural" and lyr[1] == "water":
|
||||
ntrl_water = True
|
||||
break
|
||||
ntrl_idx = ntrl_idx + 1
|
||||
# These files will need to be generated after manual check of the orthos
|
||||
if os.path.isfile(mstr_datafolder + "z_orthographic/data" + self._latlngfld + "/water/" + str(self._ty) + "_" + str(self._tx)) == True:
|
||||
# natural:water
|
||||
ntrl_water = False
|
||||
ntrl_idx = 0
|
||||
for lyr in self._lyrnames:
|
||||
if lyr[0] == "natural" and lyr[1] == "water":
|
||||
ntrl_water = True
|
||||
break
|
||||
ntrl_idx = ntrl_idx + 1
|
||||
|
||||
if ntrl_water == True:
|
||||
if ntrl_water == True:
|
||||
|
||||
# We'll go through all layers and "shavve off" excess.
|
||||
# This way we can hopefully correct incorrect line and polygon renders.
|
||||
for l in range(0, len(layers)):
|
||||
if l < ntrl_idx: # <- We don't want to load the target layer itself
|
||||
lyrpix = layers[l].load()
|
||||
wtr_pix = layers[ntrl_idx].load()
|
||||
for y in range(0, self._tile.height):
|
||||
for x in range(0, self._tile.width):
|
||||
lp = lyrpix[x,y]
|
||||
wp = wtr_pix[x,y]
|
||||
if lp[3] > 0:
|
||||
a = 255 - lp[3]
|
||||
if a < wp[3]:
|
||||
c = (wp[0], wp[1], wp[2], a)
|
||||
wtr_pix[x,y] = c
|
||||
# We'll go through all layers and "shavve off" excess.
|
||||
# This way we can hopefully correct incorrect line and polygon renders.
|
||||
for l in range(0, len(layers)):
|
||||
if l < ntrl_idx: # <- We don't want to load the target layer itself
|
||||
lyrpix = layers[l].load()
|
||||
wtr_pix = layers[ntrl_idx].load()
|
||||
for y in range(0, self._tile.height):
|
||||
for x in range(0, self._tile.width):
|
||||
lp = lyrpix[x,y]
|
||||
wp = wtr_pix[x,y]
|
||||
if lp[3] > 0:
|
||||
a = 255 - lp[3]
|
||||
if a < wp[3]:
|
||||
c = (wp[0], wp[1], wp[2], a)
|
||||
wtr_pix[x,y] = c
|
||||
|
||||
# water:river
|
||||
river_water = False
|
||||
river_idx = 0
|
||||
for lyr in self._lyrnames:
|
||||
if lyr[0] == "water" and lyr[1] == "river":
|
||||
river_water = True
|
||||
break
|
||||
river_idx = river_idx + 1
|
||||
# water:river
|
||||
river_water = False
|
||||
river_idx = 0
|
||||
for lyr in self._lyrnames:
|
||||
if lyr[0] == "water" and lyr[1] == "river":
|
||||
river_water = True
|
||||
break
|
||||
river_idx = river_idx + 1
|
||||
|
||||
if river_water == True:
|
||||
if river_water == True:
|
||||
|
||||
# We'll go through all layers and "shavve off" excess.
|
||||
# This way we can hopefully correct incorrect line and polygon renders.
|
||||
for l in range(0, len(layers)):
|
||||
if l < river_idx and l != ntrl_idx: # <- We don't want to load the target layer itself
|
||||
lyrpix = layers[l].load()
|
||||
wtr_pix = layers[river_idx].load()
|
||||
for y in range(0, self._tile.height):
|
||||
for x in range(0, self._tile.width):
|
||||
lp = lyrpix[x,y]
|
||||
wp = wtr_pix[x,y]
|
||||
if lp[3] > 0:
|
||||
a = 255 - lp[3]
|
||||
if a < wp[3]:
|
||||
c = (wp[0], wp[1], wp[2], a)
|
||||
wtr_pix[x,y] = c
|
||||
# We'll go through all layers and "shavve off" excess.
|
||||
# This way we can hopefully correct incorrect line and polygon renders.
|
||||
for l in range(0, len(layers)):
|
||||
if l < river_idx and l != ntrl_idx: # <- We don't want to load the target layer itself
|
||||
lyrpix = layers[l].load()
|
||||
wtr_pix = layers[river_idx].load()
|
||||
for y in range(0, self._tile.height):
|
||||
for x in range(0, self._tile.width):
|
||||
lp = lyrpix[x,y]
|
||||
wp = wtr_pix[x,y]
|
||||
if lp[3] > 0:
|
||||
a = 255 - lp[3]
|
||||
if a < wp[3]:
|
||||
c = (wp[0], wp[1], wp[2], a)
|
||||
wtr_pix[x,y] = c
|
||||
|
||||
return layers
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user