Python底图m.arcgisimage在保存图像时不显示服务,但在使用plt.show时显示

时间:2018-05-22 14:11:17

标签: python python-3.x matplotlib matplotlib-basemap

我正在使用tkinter开发GUI以使用底图创建地图。我使用<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>FILE</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <h1>hello world</h1> </body> </html> 来获得更好的地图背景。当我使用m.arcgisimage()时,它会显示我使用plt.show()选择的服务的地图。但是,当我使用m.arcgisimage()时,它不显示任何背景。

我的代码:

plt.savefig()

我使用包含所有底图服务的下拉菜单选择不同的背景方法。 “无 - 空白”告诉程序不使用try: if basemap_service != 'None - blank': basemap_selection = basemap_service.strip() print("using {}".format(basemap_selection)) m.arcgisimage(service = basemap_selection, xpixels = resolution) else: pass except: output_delete_insert(basemap_service + ": HTTP Error. - could not get basemap. Try a different service.") 绘制底图背景。当选择GUI中的按钮来保存地图时,它会打印出上面代码中m.arcgisimage()语句中的内容。

我不知道该怎么做,因为即使程序进入print语句,它也没有给我我要求的背景图像。

1 个答案:

答案 0 :(得分:0)

已解决:当我使用 resource "aws_vpc_endpoint" "kms" { vpc_id = "${aws_vpc.main.id}" service_name = "com.amazonaws.${var.aws_region}.kms" vpc_endpoint_type = "Interface" subnet_ids = [ <my subnet ids> ] security_group_ids = [ <my sg ids> ] private_dns_enabled = true } (我使用tkinter)时,当resolution.get()参数需要整数时,它将它作为字符串提供给我。因为我抛出异常(在我的情况下不正确),程序继续并且没有停止。它应该是:

xpixels