]> marstr Code Repo - orthographic/commitdiff
RC2 Release - amended stream rendering, corrected street line adding, check for exist...
authormarstr <marcus@marstr.online>
Sun, 1 Sep 2024 09:13:11 +0000 (11:13 +0200)
committermarstr <marcus@marstr.online>
Sun, 1 Sep 2024 09:13:11 +0000 (11:13 +0200)
layergen.py
tiledb.py
tilegen.py

index 39cc85c91c50d690a8d667d04b0061f3d56bd175..d25a772824d1e93710a9365b3387fb92484cb169 100644 (file)
@@ -293,6 +293,12 @@ class mstr_layergen:
                     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
@@ -502,7 +508,7 @@ class mstr_layergen:
                     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()
index c8b73638147ea76a4c7ee850d597aa073c090894..9c81c508b75084cb6ad7e88073406435d17f4c9d 100644 (file)
--- a/tiledb.py
+++ b/tiledb.py
@@ -53,7 +53,7 @@ class mstr_tiledb:
 
     # Insert an airport with ICAO code
     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
index e1fbc0f63603a54fe1d48e33dbc47a2d9f25c613..bdb1e13aa984f21db79ba09c92c623a040c7a18b 100644 (file)
@@ -67,43 +67,47 @@ class mstr_tilegen:
         # 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)