(MapRenderer.render_map): Only try to optimize if a raster layer is visible. Fixes RTbug #1931. Only draw the raster layer if the gdal library is available. Addresses RTbug #1877.