From a1483fccc32de0a960436f99b8b1c7c140a97088 Mon Sep 17 00:00:00 2001 From: marstr Date: Tue, 3 Sep 2024 20:49:35 +0200 Subject: [PATCH] Changed path delimiter from "\\" to "/" for cross OS compatibility --- defines.py | 18 ++++++++--------- functions.py | 2 +- layergen.py | 52 ++++++++++++++++++++++++------------------------- maskgen.py | 4 ++-- orthographic.py | 16 +++++++-------- osmxml.py | 2 +- photogen.py | 6 +++--- tiledb.py | 8 ++++---- tilegen.py | 12 ++++++------ 9 files changed, 60 insertions(+), 60 deletions(-) diff --git a/defines.py b/defines.py index 2508c90..a8fc5af 100644 --- a/defines.py +++ b/defines.py @@ -13,7 +13,7 @@ # Your data folder - meaning where the cache is stored, and where the finished # tiles will go. This is also the folder where the image generation sources are # stored. -mstr_datafolder = "M:\\Developer\\Projects\\orthographic\\" +mstr_datafolder = "M:/Developer/Projects/orthographic/" # API endpoint to acquire OSM data (bonus: I have my own) mstr_osm_endpoint = "https://marstr.online/osm/v1/" @@ -180,10 +180,10 @@ mstr_mask_blur = [ ("leisure", "golf_course", 35), ("leisure", "dog_park", 35), ("leisure", "garden", 20), - ("leisure", "sports_centre", 15), - ("leisure", "pitch", 5), - ("landuse", "farmland", 15), - ("landuse", "farmyard", 15), + ("leisure", "sports_centre", 5), + ("leisure", "pitch", 2), + ("landuse", "farmland", 10), + ("landuse", "farmyard", 10), # Z-Order 2 ("landuse", "forest", 20), ("leisure", "nature_reserve", 20), @@ -193,12 +193,12 @@ mstr_mask_blur = [ ("natural", "water", 20), ("natural", "bay", 30), ("natural", "beach", 30), - ("water", "lake", 30), - ("water", "pond", 30), - ("water", "river", 30), + ("water", "lake", 20), + ("water", "pond", 20), + ("water", "river", 20), ("waterway", "river", 10), ("waterway", "stream", 10), - ("amenity", "parking", 20), + ("amenity", "parking", 10), ("highway", "pedestrian", 12), # Z-Order 4 ("highway", "motorway", 5), diff --git a/functions.py b/functions.py index 580ebce..1cd410b 100644 --- a/functions.py +++ b/functions.py @@ -18,7 +18,7 @@ from defines import * # Find out if we have a tiledata.json file at all def doesTileDataExist(lat, lng): e = False - if os.path.isfile(mstr_datafolder + "Tiles\\" + str(lat) + "_" + str(lng) + "\\data.db"): + if os.path.isfile(mstr_datafolder + "Tiles/" + str(lat) + "_" + str(lng) + "/data.db"): e = True return e diff --git a/layergen.py b/layergen.py index 81f2a6d..c24ab24 100644 --- a/layergen.py +++ b/layergen.py @@ -61,18 +61,18 @@ class mstr_layergen: # other effects. def genborder(self, edgemask, tag, value): layer = Image.new("RGBA", (self._imgsize, self._imgsize)) - root_folder = mstr_datafolder + "Textures\\" + tag + "\\" + value + root_folder = mstr_datafolder + "Textures/" + tag + "/" + value # Determine which sources we use - brd = glob.glob(root_folder + "\\brd\\b*.png") + brd = glob.glob(root_folder + "/brd/b*.png") src = -1 if len(brd) == 1: src=1 if len(brd) >= 2: src = randrange(1, len(brd)) - ptc = glob.glob(root_folder + "\\ptc\\b" + str(src) + "_p*.png") + ptc = glob.glob(root_folder + "/ptc/b" + str(src) + "_p*.png") # Load in the sources to work with - brd_src = Image.open(root_folder + "\\brd\\b" + str(src) + ".png") + brd_src = Image.open(root_folder + "/brd/b" + str(src) + ".png") ptc_src = [] for p in ptc: ptc_src.append(Image.open(p)) @@ -113,7 +113,7 @@ class mstr_layergen: # Before we generate the layer, let's check for airports in this chunk mstr_msg("layergen", "Checking for airport/s with ICAO code") osmxml = mstr_osmxml(0,0) - icao = osmxml.find_icao_codes(mstr_datafolder + "_cache\\tile.xml") + icao = osmxml.find_icao_codes(mstr_datafolder + "_cache/tile.xml") mstr_msg("layergen", "Found " + str(len(icao)) + " airport/s") # Runway surface, if any other than concrete/asphalt rw_surface = "" @@ -125,7 +125,7 @@ class mstr_layergen: if len(iccheck) == 0: self._tiledb.insert_icao(i, self._lat_number, self._lng_number, self._latitude, self._longitude) mstr_msg("layergen", "Airport/s noted in data file") - rw_surface = osmxml.find_runway_surface(mstr_datafolder + "_cache\\tile.xml") + rw_surface = osmxml.find_runway_surface(mstr_datafolder + "_cache/tile.xml") # The image for the layer itself layer = Image.new("RGBA", (self._imgsize, self._imgsize)) @@ -136,12 +136,12 @@ class mstr_layergen: if (self._isline == False and self._tag != "building") or (self._is_completion == True): # Determine where we get the our source material from - root_folder = mstr_datafolder + "Textures\\" + root_folder = mstr_datafolder + "Textures/" for s in mstr_ortho_layers: if s[0] == self._tag and s[1] == self._value: fld_main = len(s)-2 fld_sub = len(s)-1 - root_folder = root_folder + s[fld_main] + "\\" + s[fld_sub] + root_folder = root_folder + s[fld_main] + "/" + s[fld_sub] # Determine which sources to use. # First, we need to check for adjacent tile information. We then either @@ -179,12 +179,12 @@ class mstr_layergen: self._tag = al[0][2] self._value = al[0][3] - root_folder = mstr_datafolder + "Textures\\" + root_folder = mstr_datafolder + "Textures/" for s in mstr_ortho_layers: if s[0] == self._tag and s[1] == self._value: fld_main = len(s)-2 fld_sub = len(s)-1 - root_folder = root_folder + s[fld_main] + "\\" + s[fld_sub] + root_folder = root_folder + s[fld_main] + "/" + s[fld_sub] # We are south to the top tile. if len(at) == 1 and src == -1: @@ -261,12 +261,12 @@ class mstr_layergen: self._tag = ald[0][2] self._value = ald[0][3] - root_folder = mstr_datafolder + "Textures\\" + root_folder = mstr_datafolder + "Textures/" for s in mstr_ortho_layers: if s[0] == self._tag and s[1] == self._value: fld_main = len(s)-2 fld_sub = len(s)-1 - root_folder = root_folder + s[fld_main] + "\\" + s[fld_sub] + root_folder = root_folder + s[fld_main] + "/" + s[fld_sub] # Should we get here and one of the degree border checks turns out true, @@ -287,7 +287,7 @@ class mstr_layergen: mstr_msg("layergen", "Adjacency check completed") - brd = glob.glob(root_folder + "\\brd\\b*.png") + brd = glob.glob(root_folder + "/brd/b*.png") # If the adjacency check returned nothing (src is still -1), # then pick something @@ -296,10 +296,10 @@ class mstr_layergen: if len(brd) >= 2: src = randrange(1, len(brd)) - ptc = glob.glob(root_folder + "\\ptc\\b" + str(src) + "_p*.png") + ptc = glob.glob(root_folder + "/ptc/b" + str(src) + "_p*.png") # Load in the sources to work with - brd_src = Image.open(root_folder + "\\brd\\b" + str(src) + ".png") + brd_src = Image.open(root_folder + "/brd/b" + str(src) + ".png") ptc_src = [] for p in ptc: ptc_src.append(Image.open(p)) @@ -307,9 +307,9 @@ class mstr_layergen: # OK! Load the mask if self._is_completion == False: - osm_mask = Image.open( mstr_datafolder + "_cache\\" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + ".png" ) + osm_mask = Image.open( mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + ".png" ) if self._is_completion == True: - osm_mask = Image.open( mstr_datafolder + "_cache\\" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_tile-completion.png" ) + osm_mask = Image.open( mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_tile-completion.png" ) # Generate an edge mask from the original osm_edge = osm_mask.filter(ImageFilter.FIND_EDGES) @@ -369,7 +369,7 @@ class mstr_layergen: amt = randrange(1,5) for i in range(1, amt): ptc = randrange(1, 14) - img = Image.open(mstr_datafolder + "Textures\\tile\\completion\\p" + str(ptc)+".png") + img = Image.open(mstr_datafolder + "Textures/tile/completion/p" + str(ptc)+".png") lx = randrange( int(layer.width/20), layer.width - (int(layer.width/20)) - img.width ) ly = randrange( int(layer.width/20), layer.width - (int(layer.width/20)) - img.height ) layer.alpha_composite( img, (lx, ly) ) @@ -408,10 +408,10 @@ class mstr_layergen: # Store layer if self._is_completion == False: - 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" ) + 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" ) if self._is_completion == True: - layer_comp.save( mstr_datafolder + "_cache\\" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_tile-completion_layer.png" ) - #layer_final.save( mstr_datafolder + "_cache\\" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer.png" ) + layer_comp.save( mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_tile-completion_layer.png" ) + #layer_final.save( mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer.png" ) mstr_msg("layergen", "Layer image finalized and saved.") @@ -443,7 +443,7 @@ class mstr_layergen: ca = a * st aa = int(ca) shadow_pix[shf_x, y] = (0,0,0,aa) - shadow.save(mstr_datafolder + "_cache\\" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer_shadow.png") + shadow.save(mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer_shadow.png") mstr_msg("layergen", "Shadow layer completed") @@ -514,7 +514,7 @@ class mstr_layergen: if self._isline == True or self._tag == "building": # We will need the mask in question - osm_mask = Image.open( mstr_datafolder + "_cache\\" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + ".png" ) + osm_mask = Image.open( mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + ".png" ) # Generate an edge mask from the original osm_edge = osm_mask.filter(ImageFilter.FIND_EDGES) @@ -677,7 +677,7 @@ class mstr_layergen: for i in range(1, numtrees): # Pick some file pick = str(randrange(1, 11)) - tree = Image.open(mstr_datafolder + "Textures\\building\\area\\p" + pick + ".png") + tree = Image.open(mstr_datafolder + "Textures/building/area/p" + pick + ".png") trees.alpha_composite(tree, (shf_x, shf_y)) #layer_comp.paste(tree, (shf_x, shf_y)) trees.alpha_composite(layer_comp) @@ -705,7 +705,7 @@ class mstr_layergen: aa = int(ca) shadow_pix[shf_x, y] = (0,0,0,aa) shadow_pix[shf_x2, y] = (0,0,0,aa) - shadow.save(mstr_datafolder + "_cache\\" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer_shadow.png") + shadow.save(mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer_shadow.png") mstr_msg("layergen", "Shadow layer completed") # Highways and runways of any kind get some special treatment @@ -727,6 +727,6 @@ class mstr_layergen: layer_comp = layer_comp.filter(ImageFilter.GaussianBlur(radius=4)) # 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" ) + 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" ) mstr_msg("layergen", "Layer image finalized and saved.") diff --git a/maskgen.py b/maskgen.py index c040c0d..52a992b 100644 --- a/maskgen.py +++ b/maskgen.py @@ -74,7 +74,7 @@ class mstr_maskgen: if mstr_photores == 4096: imgsize=6000 mask_img = Image.new("RGBA", (imgsize, imgsize)) - tilexml = mstr_datafolder + "_cache\\tile.xml" + tilexml = mstr_datafolder + "_cache/tile.xml" xml = mstr_osmxml(0,0) fstr = str(self._box[0]) + "-" + str(self._box[1]) + "_" + str(self._box[2]) + "-" + str(self._box[3]) nds = xml.acquire_nodes(tilexml) @@ -179,7 +179,7 @@ class mstr_maskgen: imgd.line(pts, fill="#000000", width=mstr_ortho_layers[idx][2], joint="curve") # Save image - mask_img.save(mstr_datafolder + "_cache\\" + fstr + "_" + self._tag + "-" + self._value + ".png") + mask_img.save(mstr_datafolder + "_cache/" + fstr + "_" + self._tag + "-" + self._value + ".png") # Inform mstr_msg("maskgen", "Mask built.") diff --git a/orthographic.py b/orthographic.py index 451112e..34a331c 100644 --- a/orthographic.py +++ b/orthographic.py @@ -147,7 +147,7 @@ class mstr_orthographic: mstr_msg("orthographic", "Adjusted bounding box for XML object") # Determine what to do... maybe work was interrupted - if os.path.isfile(mstr_datafolder + "Tiles\\" + str(self._lat) + "_" + str(self._long) + "\\Textures\\" + str(cur_tile_y) + "_" + str(cur_tile_x) + ".jpg") == False: + if os.path.isfile(mstr_datafolder + "Tiles/" + str(self._lat) + "_" + str(self._long) + "/Textures/" + str(cur_tile_y) + "_" + str(cur_tile_x) + ".jpg") == False: # Let the user know mstr_msg("orthographic", "Generating missing orthophoto " + str(cur_tile_y) + "-" + str(cur_tile_x)) @@ -166,13 +166,13 @@ class mstr_orthographic: mstr_msg("orthographic", "Beginning generation of layers") # Generate the Tiles/lat-lng folder for the finished tile - if not os.path.exists(self._output + "/Tiles/"+str(self._lat)+"_"+str(self._long) + "\\Textures"): - os.makedirs(self._output + "/Tiles/"+str(self._lat)+"_"+str(self._long)+"\\Textures") + if not os.path.exists(self._output + "/Tiles/"+str(self._lat)+"_"+str(self._long) + "/Textures"): + os.makedirs(self._output + "/Tiles/"+str(self._lat)+"_"+str(self._long)+"/Textures") mstr_msg("orthographic", "Created tile textures folder") # Generate the Tiles/terrain folder for the finished tile - if not os.path.exists(self._output + "/Tiles/"+str(self._lat)+"_"+str(self._long) + "\\terrain"): - os.makedirs(self._output + "/Tiles/"+str(self._lat)+"_"+str(self._long)+"\\terrain") + if not os.path.exists(self._output + "/Tiles/"+str(self._lat)+"_"+str(self._long) + "/terrain"): + os.makedirs(self._output + "/Tiles/"+str(self._lat)+"_"+str(self._long)+"/terrain") mstr_msg("orthographic", "Created tile terrain folder") curlyr = 1 @@ -211,7 +211,7 @@ class mstr_orthographic: # Clear out cache if mstr_clear_cache == True: - ch = glob.glob(mstr_datafolder + "_cache\\*") + ch = glob.glob(mstr_datafolder + "_cache/*") for f in ch: if os_platform == "nt": if self._isFileAccessibleWin(f) == True: @@ -242,7 +242,7 @@ class mstr_orthographic: mstr_msg("orthographic", "Final step completed.") print("") print("") - mstr_msg("orthographic", "Tile data in: " + mstr_datafolder + "\\Tiles\\" + str(self._lat) + "_" + self._lng) + mstr_msg("orthographic", "Tile data in: " + mstr_datafolder + "/Tiles/" + str(self._lat) + "_" + self._lng) mstr_msg("orthographic", "Orthos are in the Textures subfolder") mstr_msg("orthographic", "X-Plane .ter's are in the terrain subfolder") print("") @@ -261,7 +261,7 @@ class mstr_orthographic: layers = [] - tilexml = mstr_datafolder + "_cache\\tile.xml" + tilexml = mstr_datafolder + "_cache/tile.xml" xml = mstr_osmxml(0,0) way = xml.acquire_waypoint_data(tilexml) rls = xml.acquire_relations(tilexml) diff --git a/osmxml.py b/osmxml.py index cae22eb..2a43a39 100644 --- a/osmxml.py +++ b/osmxml.py @@ -55,7 +55,7 @@ class mstr_osmxml: } r = requests.post(mstr_osm_endpoint, json=data) - xml = mstr_datafolder + "_cache\\tile.xml" + xml = mstr_datafolder + "_cache/tile.xml" if os.path.isfile(xml): os.remove(xml) with open(xml, 'wb') as textfile: diff --git a/photogen.py b/photogen.py index 066c969..4610d4d 100644 --- a/photogen.py +++ b/photogen.py @@ -39,7 +39,7 @@ class mstr_photogen: # This puts it all together. Bonus: AND saves it. def genphoto(self): # Template for the file name which is always the same - root_filename = mstr_datafolder + "\\_cache\\" + str(self._lat) + "-" + str(self._ty) + "_" + str(self._lng) + "-" + str(self._tx) + "_" + root_filename = mstr_datafolder + "/_cache/" + str(self._lat) + "-" + str(self._ty) + "_" + str(self._lng) + "-" + str(self._tx) + "_" # First, we walk through all layers and blend them on top of each other, in order mstr_msg("photogen", "Merging layers") @@ -104,7 +104,7 @@ class mstr_photogen: self._tile = self._tile.resize((mstr_photores, mstr_photores), Image.Resampling.BILINEAR) # This we can save accordingly. - self._tile.convert('RGB').save(mstr_datafolder + "Tiles\\" + str(self._lat) + "_" + str(self._lng) + "\\Textures\\" + str(self._ty) + "_" + str(self._tx) + ".jpg", format='JPEG', subsampling=0, quality=100) + self._tile.convert('RGB').save(mstr_datafolder + "Tiles/" + str(self._lat) + "_" + str(self._lng) + "/Textures/" + str(self._ty) + "_" + str(self._tx) + ".jpg", format='JPEG', subsampling=0, quality=100) # This checks the final image for empty patches. Should one be @@ -147,5 +147,5 @@ class mstr_photogen: # We do not apply any blur or other effects here - we only want the # exact pixel positions. - mask.save( mstr_datafolder + "_cache\\" + str(self._lat) + "-" + str(self._ty) + "_" + str(self._lng) + "-" + str(self._tx) + "_tile-completion.png" ) + mask.save( mstr_datafolder + "_cache/" + str(self._lat) + "-" + str(self._ty) + "_" + str(self._lng) + "-" + str(self._tx) + "_tile-completion.png" ) mstr_msg("photogen", "Generated and saved empty space mask") \ No newline at end of file diff --git a/tiledb.py b/tiledb.py index 4732dfd..805c3cd 100644 --- a/tiledb.py +++ b/tiledb.py @@ -24,7 +24,7 @@ class mstr_tiledb: self._longitude = lng # The db file will be created, should it not exist - self._conn = sqlite3.connect(mstr_datafolder + "Tiles\\" + str(self._latitude) + "_" + str(self._longitude) + "\\data.db") + self._conn = sqlite3.connect(mstr_datafolder + "Tiles/" + str(self._latitude) + "_" + str(self._longitude) + "/data.db") self._crs = self._conn.cursor() #mstr_msg("tiledb", "Database object initiated") @@ -80,7 +80,7 @@ class mstr_tiledb: rws = [] # For this we need to tap into the database of the tile, should there be one. - dbn = mstr_datafolder + "Tiles\\" + str(lat) + "_" + str(lng) + "\\data.db" + dbn = mstr_datafolder + "Tiles/" + str(lat) + "_" + str(lng) + "/data.db" if os.path.isfile(dbn): tileconn = sqlite3.connect(dbn) tilecrsr = tileconn.cursor() @@ -97,7 +97,7 @@ class mstr_tiledb: rws = [] # For this we need to tap into the database of the tile, should there be one. - dbn = mstr_datafolder + "Tiles\\" + str(lat) + "_" + str(lng) + "\\data.db" + dbn = mstr_datafolder + "Tiles/" + str(lat) + "_" + str(lng) + "/data.db" if os.path.isfile(dbn): tileconn = sqlite3.connect(dbn) tilecrsr = tileconn.cursor() @@ -111,7 +111,7 @@ class mstr_tiledb: def get_highest_latlong_from_tile(self, lat, lng): latlng = [-1, -1] # For this we need to tap into the database of the tile, should there be one. - dbn = mstr_datafolder + "Tiles\\" + str(lat) + "_" + str(lng) + "\\data.db" + dbn = mstr_datafolder + "Tiles/" + str(lat) + "_" + str(lng) + "/data.db" if os.path.isfile(dbn): tileconn = sqlite3.connect(dbn) tilecrsr = tileconn.cursor() diff --git a/tilegen.py b/tilegen.py index eb30f5c..d64dc26 100644 --- a/tilegen.py +++ b/tilegen.py @@ -68,7 +68,7 @@ class mstr_tilegen: for lt in range(1, steps_lat): for ln in range(1, steps_lng): # 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: + 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("tilegen", "Generating missing zoom level 16 ortho " + str(self._lat) + "-" + str(ln) + "_" + str(self._lng) + "-" + str(lt) + "_OG16.jpg") @@ -85,7 +85,7 @@ class mstr_tilegen: 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" + 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) @@ -95,7 +95,7 @@ class mstr_tilegen: 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) + 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 @@ -105,7 +105,7 @@ 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: + 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("tilegen", "Wrote .ter file") @@ -156,7 +156,7 @@ NO_ALPHA""" found = True break if found == False: - os.remove(mstr_datafolder + "\\Tiles\\" + str(self._lat) + "_" + str(self._lng) + "\\Textures\\" + fn) + os.remove(mstr_datafolder + "/Tiles/" + str(self._lat) + "_" + str(self._lng) + "/Textures/" + fn) mstr_msg("tilegen", "Cleanup completed") @@ -167,7 +167,7 @@ NO_ALPHA""" k_lat = self._lat + (k[0] * self._vstep) + (self._vstep * 0.5) k_lng = self._lat + (k[1] * mstr_zl_18) + (mstr_zl_18 * 0.5) k_dmt = self._findWidthOfLongitude(self._lng * mstr_zl_18) - k_fln = mstr_datafolder + "\\Tiles\\" + str(self._lat) + "_" + str(self._lng) + "\\terrain\\" + str(k[0]) + "_" + str(k[1]) + ".ter" + k_fln = mstr_datafolder + "/Tiles/" + str(self._lat) + "_" + str(self._lng) + "/terrain/" + str(k[0]) + "_" + str(k[1]) + ".ter" ter_content = """A 800 TERRAIN -- 2.30.2