osm_edge = osm_edge.filter(ImageFilter.BoxBlur(radius=2))
layer_border = self.genborder(osm_edge, "landuse", "meadow")
layer_comp.alpha_composite(layer_border)
+ # Give streams a more natural look
+ if self._tag == "waterway" and (self._value == "stream" or self._value == "river"):
+ osm_edge = osm_edge.filter(ImageFilter.ModeFilter(size=15))
+ osm_edge = osm_edge.filter(ImageFilter.BoxBlur(radius=2))
+ layer_border = self.genborder(osm_edge, "natural", "wetland")
+ layer_comp.alpha_composite(layer_border)
# Store layer
mstr_msg("mstr_layergen", "Shadow layer completed")
# Highways and runways of any kind get some special treatment
- if (self._tag == "highway" and self._value == "motorway") or (self._tag == "highway" and self._value == "unclassified") or (self._tag == "aeroway" and self._value == "runway"):
+ if (self._tag == "highway" and self._value == "motorway") or (self._tag == "highway" and self._value == "primary") or (self._tag == "highway" and self._value == "secondary") or (self._tag == "highway" and self._value == "tertiary") or (self._tag == "aeroway" and self._value == "runway"):
# We will now add some white lines for coolness
mask_pix = osm_edge.load()
layer_comp_pix = layer_comp.load()
# OK... so. Let's finish this.
for lt in range(1, steps_lat):
for ln in range(1, steps_lng):
- # Find out which tiles to process
- tiles = findZL16tiles(cur_lat, cur_lng)
-
- # Generate the ZL16 image
- zl16 = Image.new("RGB", (mstr_photores, mstr_photores))
-
- # Walk through this array
- xpos = 0
- ypos = int(scaled_res*3)
- for i in range(0, 3):
- for j in range(0, 3):
- # We may run into situations where ask for tiles that don't exist...
- # Let's make sure we can continue
- fpath = mstr_datafolder + "Tiles\\" + str(self._lat) + "_" + str(self._lng) + "\\Textures\\" + str(tiles[i][j][0]) + "_" + str(tiles[i][j][1]) + ".jpg"
- if os.path.isfile( fpath ):
- tlimg = Image.open(fpath)
- tlimg = tlimg.resize((scaled_res,scaled_res), Image.Resampling.BILINEAR)
- zl16.paste(tlimg, (xpos, ypos))
- xpos = xpos + scaled_res
- xpos = 0
- ypos = ypos - scaled_res
+ # Check if we need to do something
+ if os.path.isfile(mstr_datafolder + "Tiles\\" + str(self._lat) + "_" + str(self._lng) + "\\Textures\\" + str(self._lat) + "-" + str(ln) + "_" + str(self._lng) + "-" + str(lt) + "_OG16.jpg") == False:
+
+ mstr_msg("mstr_tilegen", "Generating missing zoom level 16 ortho " + str(self._lat) + "-" + str(ln) + "_" + str(self._lng) + "-" + str(lt) + "_OG16.jpg")
+
+ # Find out which tiles to process
+ tiles = findZL16tiles(cur_lat, cur_lng)
- # Now save this image
- zl16.save(mstr_datafolder + "Tiles\\" + str(self._lat) + "_" + str(self._lng) + "\\Textures\\" + str(self._lat) + "-" + str(ln) + "_" + str(self._lng) + "-" + str(lt) + "_OG16.jpg", format='JPEG', subsampling=0, quality=100)
+ # Generate the ZL16 image
+ zl16 = Image.new("RGB", (mstr_photores, mstr_photores))
- # Store a terrain file
- dmt = self._findWidthOfLongitude(a_lat) * mstr_zl_16
- ter_content = """A
+ # Walk through this array
+ xpos = 0
+ ypos = int(scaled_res*3)
+ for i in range(0, 3):
+ for j in range(0, 3):
+ # We may run into situations where ask for tiles that don't exist...
+ # Let's make sure we can continue
+ fpath = mstr_datafolder + "Tiles\\" + str(self._lat) + "_" + str(self._lng) + "\\Textures\\" + str(tiles[i][j][0]) + "_" + str(tiles[i][j][1]) + ".jpg"
+ if os.path.isfile( fpath ):
+ tlimg = Image.open(fpath)
+ tlimg = tlimg.resize((scaled_res,scaled_res), Image.Resampling.BILINEAR)
+ zl16.paste(tlimg, (xpos, ypos))
+ xpos = xpos + scaled_res
+ xpos = 0
+ ypos = ypos - scaled_res
+
+ # Now save this image
+ zl16.save(mstr_datafolder + "Tiles\\" + str(self._lat) + "_" + str(self._lng) + "\\Textures\\" + str(self._lat) + "-" + str(ln) + "_" + str(self._lng) + "-" + str(lt) + "_OG16.jpg", format='JPEG', subsampling=0, quality=100)
+
+ # Store a terrain file
+ dmt = self._findWidthOfLongitude(a_lat) * mstr_zl_16
+ ter_content = """A
800
TERRAIN
LOAD_CENTER """ + str(a_lat) + " " + str(a_lng) + " " + str(dmt) + " " + "../Textures/" + str(self._lat) + "-" + str(ln) + "_" + str(self._lng) + "-" + str(lt) + "_OG_16.jpg"+"""
NO_ALPHA"""
- with open(mstr_datafolder + "\\Tiles\\"+str(self._lat)+"_"+str(self._lng)+"\\terrain\\"+str(self._lat)+"_"+str(lt)+"-"+str(self._lng)+"-"+str(ln)+"_OG16.ter", 'w') as textfile:
- textfile.write(ter_content)
- mstr_msg("mstr_tilegen", "Wrote .ter file")
-
+ with open(mstr_datafolder + "\\Tiles\\"+str(self._lat)+"_"+str(self._lng)+"\\terrain\\"+str(self._lat)+"_"+str(lt)+"-"+str(self._lng)+"-"+str(ln)+"_OG16.ter", 'w') as textfile:
+ textfile.write(ter_content)
+ mstr_msg("mstr_tilegen", "Wrote .ter file")
# Adjust
a_lng = a_lng + (mstr_zl_16 * 4)