# The tags that cast shadows
mstr_shadow_casters = [
("landuse", "forest"),
- ("building", "yes"),
- ("building", "office"),
- ("building", "retail"),
- ("building", "industrial"),
("leisure", "nature_reserve")
]
("highway", "pedestrian", 4),
# Z-Order 4
("highway", "motorway", 32),
- ("highway", "primary", 14),
+ ("highway", "primary", 25),
("highway", "secondary", 13),
- ("highway", "tertiary", 12),
+ ("highway", "tertiary", 20),
("highway", "unclassified", 12),
("highway", "living_street", 12),
("highway", "residential", 12),
# Blur values for the single masks of the ortho layers
mstr_mask_blur = [
# Z-Order 0
- ("landuse", "residential", 5),
- ("boundary", "administrative", 5),
+ ("landuse", "residential", 30),
+ ("boundary", "administrative", 30),
# Z-Order 1
- ("landuse", "grass", 10),
- ("landuse", "cemetery", 10),
- ("landuse", "greenfield", 10),
- ("landuse", "orchard", 10),
- ("landuse", "meadow", 10),
- ("barrier", "hedge", 4),
- ("landuse", "recreation_ground", 10),
- ("landuse", "vineyard", 10),
- ("natural", "grassland", 10),
- ("natural", "wetland", 10),
- ("natural", "scrub", 10),
- ("natural", "heath", 10),
- ("leisure", "park", 10),
- ("leisure", "golf_course", 15),
- ("leisure", "dog_park", 12),
- ("leisure", "garden", 12),
- ("leisure", "sports_centre", 12),
+ ("landuse", "grass", 30),
+ ("landuse", "cemetery", 30),
+ ("landuse", "greenfield", 30),
+ ("landuse", "orchard", 30),
+ ("landuse", "meadow", 30),
+ ("barrier", "hedge", 12),
+ ("landuse", "recreation_ground", 30),
+ ("landuse", "vineyard", 30),
+ ("natural", "grassland", 30),
+ ("natural", "wetland", 30),
+ ("natural", "scrub", 30),
+ ("natural", "heath", 30),
+ ("leisure", "park", 30),
+ ("leisure", "golf_course", 35),
+ ("leisure", "dog_park", 35),
+ ("leisure", "garden", 20),
+ ("leisure", "sports_centre", 15),
("leisure", "pitch", 10),
- ("landuse", "farmland", 10),
- ("landuse", "farmyard", 10),
+ ("landuse", "farmland", 15),
+ ("landuse", "farmyard", 15),
# Z-Order 2
- ("landuse", "forest", 10),
- ("leisure", "nature_reserve", 10),
- ("landuse", "military", 10),
+ ("landuse", "forest", 30),
+ ("leisure", "nature_reserve", 30),
+ ("landuse", "military", 30),
# Z-Order 3
- ("natural", "bare_rock", 12),
- ("natural", "water", 12),
- ("natural", "bay", 12),
- ("natural", "beach", 15),
- ("water", "lake", 10),
- ("water", "pond", 10),
- ("water", "river", 10),
+ ("natural", "bare_rock", 25),
+ ("natural", "water", 20),
+ ("natural", "bay", 30),
+ ("natural", "beach", 30),
+ ("water", "lake", 30),
+ ("water", "pond", 30),
+ ("water", "river", 30),
("waterway", "river", 10),
- ("waterway", "stream", 8),
- ("amenity", "parking", 10),
- ("highway", "pedestrian", 4),
+ ("waterway", "stream", 10),
+ ("amenity", "parking", 20),
+ ("highway", "pedestrian", 12),
# Z-Order 4
- ("highway", "motorway", 4),
- ("highway", "primary", 3),
- ("highway", "secondary", 2),
- ("highway", "tertiary", 2),
- ("highway", "unclassified", 2),
- ("highway", "living_street", 4),
- ("highway", "residential", 4),
- ("highway", "service", 4),
- ("highway", "footway", 4),
+ ("highway", "motorway", 5),
+ ("highway", "primary", 5),
+ ("highway", "secondary", 5),
+ ("highway", "tertiary", 5),
+ ("highway", "unclassified", 10),
+ ("highway", "living_street", 10),
+ ("highway", "residential", 10),
+ ("highway", "service", 5),
+ ("highway", "footway", 5),
("highway", "track", 3),
("highway", "path", 3),
("railway", "rail", 4),
# There are some things we need to use sources for, and some things, we do not.
# We need to differentiate that.
- if (self._isline == False and self._tag != "building") or (self._is_completion == True):
+ if (self._isline == False) or (self._is_completion == True):
# Determine where we get the our source material from
root_folder = mstr_datafolder + "Textures\\"
for s in mstr_ortho_layers:
if mask_pix[x, y][3] > 0:
rgb=layer_pix[x,y]
a=mask_pix[x,y]
- layer_comp_pix[x, y] = ( rgb[0], rgb[1], rgb[2], a[3] )
+ if self._value == "residential":
+ layer_comp_pix[x, y] = ( rgb[0], rgb[1], rgb[2], int(a[3]/2))
+ if self._value != "residential":
+ layer_comp_pix[x, y] = ( rgb[0], rgb[1], rgb[2], a[3])
# For some things, we will need to add a border and then add this to the layer.
layer_border = None
layer_border = self.genborder(osm_edge, "landuse", "meadow")
layer_comp.alpha_composite(layer_border)
+ # If this is the completion layer, we may add some aditional patches to the image
+ # for more realism
+ if self._is_completion == True:
+ cl = randrange(1, 10)
+ for i in range(1, cl):
+ p = randrange(1, 2)
+ ptc = Image.open(mstr_datafolder + "Textures\\tile\\completion\\p"+str(p)+".png")
+ rdx = randrange(1, self._imgsize-1-ptc.width)
+ rdy = randrange(1, self._imgsize-1-ptc.height)
+ layer_comp.alpha_composite(ptc, (rdx, rdy))
+
+
# 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" )
# If we encounter one of these road-specific tags, we need to proceed differently.
- if self._isline == True or self._tag == "building":
+ if self._isline == True:
# 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" )
d = randrange(41, 61)
layer_comp_pix[x, y] = ( d,d,d,a[3] )
if self._tag == "highway":
- d = randrange(81, 101)
+ d = randrange(160,180)
layer_comp_pix[x, y] = ( d,d,d,a[3] )
if self._tag == "waterway" and (self._value == "stream" or self._value == "river"):
d = randrange(1, 15)
- layer_comp_pix[x, y] = ( 19-d, 62-d, 71-d, a[3] )
+ layer_comp_pix[x, y] = ( 129-d, 148-d, 159-d, a[3] )
if self._tag == "building":
r = randrange(1, 20)