("highway", "unclassified", 17),\r
("highway", "living_street", 12),\r
("waterway", "river", 10),\r
- ("waterway", "stream", 10),\r
+ ("waterway", "stream", 2),\r
("leisure", "nature_reserve", "landuse", "forest"),\r
("landuse", "forest", "landuse", "forest"),\r
("natural", "wood", "natural", "wood"),\r
for y in range(img.height):\r
for x in range(img.width):\r
c = imgp[x,y]\r
- nc = (c[0], c[1], c[2], int(imgp[x,y][3]*0.5))\r
+ nc = (c[0], c[1], c[2], int(imgp[x,y][3]*0.4))\r
imgp[x,y] = nc\r
lx = randrange( self._imgsize - img.width ) \r
ly = randrange( self._imgsize - img.height )\r
w = randrange(60, 96)\r
a=mask_pix[x,y]\r
layer_comp_pix[x, y] = ( w,w,w,a[3] )\r
+ mstr_msg("layergen", "Street lines added")\r
\r
\r
- mstr_msg("layergen", "Street lines added")\r
+ # Same as above, except that streams are lines and are not drawn as polygons.\r
+ # Therefore this part needs to be in here as well.\r
+ if self._tag == "waterway" and self._value == "stream":\r
+ mstr_msg("layergen", "Generating inland water mask")\r
+ inl_mask = Image.new("RGBA", (self._imgsize, self._imgsize), (0,0,0,0))\r
+ lyr_pix = layer_comp.load()\r
+ inl_pix = inl_mask.load()\r
+ for y in range(self._imgsize):\r
+ for x in range(self._imgsize):\r
+ l = lyr_pix[x,y]\r
+ if l[3] > 65:\r
+ b = 255 - l[3]\r
+ inl_pix[x,y] = (255,0,255,255)\r
+ inl_mask.save(mstr_datafolder + "_cache/" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer_mask.png")\r
+ mstr_msg("layergen", "Inland water mask generated and saved")\r
+\r
+ \r
+ # Blur roads a bit\r
+ if self._tag == "highway":\r
+ layer_comp = layer_comp.filter(ImageFilter.GaussianBlur(radius=1))\r
\r
- if self._tag == "waterway" and (self._value == "river" or self._value == "stream"):\r
- layer_comp = layer_comp.filter(ImageFilter.GaussianBlur(radius=4))\r
\r
# Store layer\r
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" )\r
# Previously, I downloaded all XML files in one go - but to ease the\r
# stress on OSM servers and my server, we will do acquire the data\r
# only for the current processed part of the tile.\r
- while bb_lat < self._lat + 1:\r
- while bb_lng < self._long + 1:\r
+ for lat_grid in range(1, maxlatlng[0]+1):\r
+ for lng_grid in range(1, maxlatlng[1]+1):\r
# Adjust bounding box\r
osmxml.adjust_bbox(bb_lat, bb_lng, bb_lat_edge, bb_lng_edge)\r
mstr_msg("orthographic", "Adjusted bounding box for XML object")\r