RC2 Release - amended stream rendering, corrected street line adding, check for existence of ZL16 tiles so that work can continue at a later stage
This commit is contained in:
parent
f9597fbb79
commit
adcf86cc70
@ -293,6 +293,12 @@ class mstr_layergen:
|
|||||||
osm_edge = osm_edge.filter(ImageFilter.BoxBlur(radius=2))
|
osm_edge = osm_edge.filter(ImageFilter.BoxBlur(radius=2))
|
||||||
layer_border = self.genborder(osm_edge, "landuse", "meadow")
|
layer_border = self.genborder(osm_edge, "landuse", "meadow")
|
||||||
layer_comp.alpha_composite(layer_border)
|
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
|
# Store layer
|
||||||
@ -502,7 +508,7 @@ class mstr_layergen:
|
|||||||
mstr_msg("mstr_layergen", "Shadow layer completed")
|
mstr_msg("mstr_layergen", "Shadow layer completed")
|
||||||
|
|
||||||
# Highways and runways of any kind get some special treatment
|
# 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
|
# We will now add some white lines for coolness
|
||||||
mask_pix = osm_edge.load()
|
mask_pix = osm_edge.load()
|
||||||
layer_comp_pix = layer_comp.load()
|
layer_comp_pix = layer_comp.load()
|
||||||
|
@ -53,7 +53,7 @@ class mstr_tiledb:
|
|||||||
|
|
||||||
# Insert an airport with ICAO code
|
# Insert an airport with ICAO code
|
||||||
def insert_icao(self, icao, tv, th, lat, lng):
|
def insert_icao(self, icao, tv, th, lat, lng):
|
||||||
self._conn.execute("INSERT INTO airports VALUES ('"+icao+"', "+tv+", "+th+", "+lat+", "+lng+");")
|
self._conn.execute("INSERT INTO airports VALUES ('"+icao+"', "+str(tv)+", "+str(th)+", "+str(lat)+", "+str(lng)+");")
|
||||||
|
|
||||||
|
|
||||||
# Commit a query or a number of queries
|
# Commit a query or a number of queries
|
||||||
|
58
tilegen.py
58
tilegen.py
@ -67,43 +67,47 @@ class mstr_tilegen:
|
|||||||
# OK... so. Let's finish this.
|
# OK... so. Let's finish this.
|
||||||
for lt in range(1, steps_lat):
|
for lt in range(1, steps_lat):
|
||||||
for ln in range(1, steps_lng):
|
for ln in range(1, steps_lng):
|
||||||
# Find out which tiles to process
|
# Check if we need to do something
|
||||||
tiles = findZL16tiles(cur_lat, cur_lng)
|
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:
|
||||||
|
|
||||||
# Generate the ZL16 image
|
mstr_msg("mstr_tilegen", "Generating missing zoom level 16 ortho " + str(self._lat) + "-" + str(ln) + "_" + str(self._lng) + "-" + str(lt) + "_OG16.jpg")
|
||||||
zl16 = Image.new("RGB", (mstr_photores, mstr_photores))
|
|
||||||
|
|
||||||
# Walk through this array
|
# Find out which tiles to process
|
||||||
xpos = 0
|
tiles = findZL16tiles(cur_lat, cur_lng)
|
||||||
ypos = int(scaled_res*3)
|
|
||||||
for i in range(0, 3):
|
# Generate the ZL16 image
|
||||||
for j in range(0, 3):
|
zl16 = Image.new("RGB", (mstr_photores, mstr_photores))
|
||||||
# We may run into situations where ask for tiles that don't exist...
|
|
||||||
# Let's make sure we can continue
|
# Walk through this array
|
||||||
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
|
xpos = 0
|
||||||
ypos = ypos - scaled_res
|
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
|
# 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)
|
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
|
# Store a terrain file
|
||||||
dmt = self._findWidthOfLongitude(a_lat) * mstr_zl_16
|
dmt = self._findWidthOfLongitude(a_lat) * mstr_zl_16
|
||||||
ter_content = """A
|
ter_content = """A
|
||||||
800
|
800
|
||||||
TERRAIN
|
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"+"""
|
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"""
|
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:
|
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)
|
textfile.write(ter_content)
|
||||||
mstr_msg("mstr_tilegen", "Wrote .ter file")
|
mstr_msg("mstr_tilegen", "Wrote .ter file")
|
||||||
|
|
||||||
|
|
||||||
# Adjust
|
# Adjust
|
||||||
a_lng = a_lng + (mstr_zl_16 * 4)
|
a_lng = a_lng + (mstr_zl_16 * 4)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user