kopia lustrzana https://github.com/hholzgra/ocitysmap
Prevent map background from filling the full canvas
The cairo_renderer in recent Mapnik versions fills
the map background with the background_color
set in the active stylesheet.
By setting a clip area before calling mapnik.render()
we restrict the background filling to the area we
actually want to have the map in. Otherwise it would
fill the whole canvas and so paint over already
existing features.
See also: 12dfcef3a0
upstream_dev_mapnik_background_clip
rodzic
bb7a8f8696
commit
aaa21161c2
|
@ -435,6 +435,10 @@ class MultiPageRenderer(Renderer):
|
|||
ctx.save()
|
||||
ctx.translate(0, 0.3 * h + Renderer.PRINT_SAFE_MARGIN_PT)
|
||||
|
||||
# prevent map background from filling the full canvas
|
||||
ctx.rectangle(0, 0, w, h / 2)
|
||||
ctx.clip()
|
||||
|
||||
# Render the map !
|
||||
mapnik.render(self._front_page_map.get_rendered_map(), ctx)
|
||||
ctx.restore()
|
||||
|
|
|
@ -396,6 +396,10 @@ class SinglePageRenderer(Renderer):
|
|||
##
|
||||
ctx.save()
|
||||
|
||||
# prevent map background from filling the full canvas
|
||||
ctx.rectangle(map_coords_dots[0], map_coords_dots[1], map_coords_dots[2], map_coords_dots[3])
|
||||
ctx.clip()
|
||||
|
||||
# Prepare to draw the map at the right location
|
||||
ctx.translate(map_coords_dots[0], map_coords_dots[1])
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue