目录
使用python 的 Cartopy 绘制底图时,其自带的
.stock_img()分辨率较低,不能满足小区域绘制需求,因此调用天地图api实现清晰底图绘制。
获取天地图api
在官网注册并申请地图api

编辑所需代码
新建文本,复制如下代码,其中
*天地图地图服务二级域名包括t0-t7,您可以随机选择使用,如http://t2.tianditu.gov.cn/vec_c/wmts?tk=您的密钥
参考http://lbs.tianditu.gov.cn/server/MapService.html
并替换自己的key
# 矢量底图-经纬度
class MAP_vec_c(GoogleWTS):
def _image_url(self, tile):
x, y, z = tile
key = '**********'
url = 'http://t0.tianditu.gov.cn/DataServer?T=vec_c&x=%s&y=%s&l=%s&tk=%s' % (x, y, z, key)
return url
# 矢量底图-墨卡托
class MAP_vec_w(GoogleWTS):
def _image_url(self, tile):
x, y, z = tile
key = '**********'
url = 'http://t0.tianditu.gov.cn/DataServer?T=vec_w&x=%s&y=%s&l=%s&tk=%s' % (x, y, z, key)
return url
# 矢量注记-经纬度
class MAP_cva_c(GoogleWTS):
def _image_url(self, tile):
x, y, z = tile
key = '**********'
url = 'http://t0.tianditu.gov.cn/DataServer?T=cva_c&x=%s&y=%s&l=%s&tk=%s' % (x, y, z, key)
return url
# 矢量注记-墨卡托
class MAP_cva_w(GoogleWTS):
def _image_url(self, tile):
x, y, z = tile
key = '**********'
url = 'http://t0.tianditu.gov.cn/DataServer?T=cva_w&x=%s&y=%s&l=%s&tk=%s' % (x, y, z, key)
return url
# 影像底图-经纬度
class MAP_img_c(GoogleWTS):
def _image_url(self, tile):
x, y, z = tile
key = '**********'
url = 'http://t0.tianditu.gov.cn/DataServer?T=img_c&x=%s&y=%s&l=%s&tk=%s' % (x, y, z, key)
return url
# 影像底图-墨卡托
class MAP_img_w(GoogleWTS


101

被折叠的 条评论
为什么被折叠?



