Correction to make streams appear correctly. Refinement to streets, roads, highways. Corrected bug in orthographic main class so that it renders correct amount of latitude and longitude tiles/orthos.

This commit is contained in:
Marcus Str. 2024-10-06 23:16:06 +02:00
parent 10a078b9f1
commit 10e87db4a0
3 changed files with 26 additions and 8 deletions

View File

@ -154,7 +154,7 @@ mstr_ortho_layers = [
("highway", "unclassified", 17),
("highway", "living_street", 12),
("waterway", "river", 10),
("waterway", "stream", 10),
("waterway", "stream", 2),
("leisure", "nature_reserve", "landuse", "forest"),
("landuse", "forest", "landuse", "forest"),
("natural", "wood", "natural", "wood"),

View File

@ -445,7 +445,7 @@ class mstr_layergen:
for y in range(img.height):
for x in range(img.width):
c = imgp[x,y]
nc = (c[0], c[1], c[2], int(imgp[x,y][3]*0.5))
nc = (c[0], c[1], c[2], int(imgp[x,y][3]*0.4))
imgp[x,y] = nc
lx = randrange( self._imgsize - img.width )
ly = randrange( self._imgsize - img.height )
@ -910,12 +910,30 @@ class mstr_layergen:
w = randrange(60, 96)
a=mask_pix[x,y]
layer_comp_pix[x, y] = ( w,w,w,a[3] )
mstr_msg("layergen", "Street lines added")
if self._tag == "waterway" and (self._value == "river" or self._value == "stream"):
layer_comp = layer_comp.filter(ImageFilter.GaussianBlur(radius=4))
# Same as above, except that streams are lines and are not drawn as polygons.
# Therefore this part needs to be in here as well.
if self._tag == "waterway" and self._value == "stream":
mstr_msg("layergen", "Generating inland water mask")
inl_mask = Image.new("RGBA", (self._imgsize, self._imgsize), (0,0,0,0))
lyr_pix = layer_comp.load()
inl_pix = inl_mask.load()
for y in range(self._imgsize):
for x in range(self._imgsize):
l = lyr_pix[x,y]
if l[3] > 65:
b = 255 - l[3]
inl_pix[x,y] = (255,0,255,255)
inl_mask.save(mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer_mask.png")
mstr_msg("layergen", "Inland water mask generated and saved")
# Blur roads a bit
if self._tag == "highway":
layer_comp = layer_comp.filter(ImageFilter.GaussianBlur(radius=1))
# Store layer
layer_comp.save( mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer.png" )

View File

@ -169,8 +169,8 @@ class mstr_orthographic:
# Previously, I downloaded all XML files in one go - but to ease the
# stress on OSM servers and my server, we will do acquire the data
# only for the current processed part of the tile.
while bb_lat < self._lat + 1:
while bb_lng < self._long + 1:
for lat_grid in range(1, maxlatlng[0]+1):
for lng_grid in range(1, maxlatlng[1]+1):
# Adjust bounding box
osmxml.adjust_bbox(bb_lat, bb_lng, bb_lat_edge, bb_lng_edge)
mstr_msg("orthographic", "Adjusted bounding box for XML object")