Skip to content

Commit

Permalink
Merge pull request #16 from liuxsdev/fix_mapload
Browse files Browse the repository at this point in the history
Fix mapload
  • Loading branch information
liuxspro authored Nov 17, 2023
2 parents b61f589 + 9e4e756 commit 19e5f7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tianditu-tools/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name=TianDiTu Tools
qgisMinimumVersion=3.4
description=天地图底图加载
about=QGIS 天地图工具,方便进行天地图瓦片底图的添加以及简单实现了部分天地图 Web 服务 API(地名搜索、地理编码查询、逆地理编码查询)
version=0.3.0
version=0.3.1
tags=basemap, xyz, tianditu, geocoder, 天地图
icon=images/icon.png
experimental=False
Expand All @@ -14,6 +14,8 @@ homepage=https://github.com/liuxsdev/qgis-plugin-tianditu
tracker=https://github.com/liuxsdev/qgis-plugin-tianditu/issues
repository=https://github.com/liuxsdev/qgis-plugin-tianditu
changelog=
Version 0.3.1 2023/11/17:
* 🐛 修复3.34版本上无法加载地图
Version 0.3.0 2023/7/1:
* ✨ 新增功能:调整缩放比例至正确的 Zoom Level
* 💄 更换图标
Expand Down
3 changes: 3 additions & 0 deletions tianditu-tools/settingDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def __init__(self, extra_map_action):
# 设置界面
self.setupUi(self)
self.mLineEdit_key.setText(self.config.key)
if len(self.mLineEdit_key.text()) == 0:
self.pushButton.setEnabled(False)
self.mLineEdit_key.textChanged.connect(self.on_key_LineEdit_changed)
if self.config.keyisvalid:
self.label_keystatus.setText("正常")
Expand Down Expand Up @@ -96,6 +98,7 @@ def handle_ping_finished(self, status):
self.comboBox.setItemText(min_index, f"t{min_index} {status[min_index]}*")

def on_key_LineEdit_changed(self):
self.pushButton.setEnabled(True)
current_text = self.mLineEdit_key.text()
# 删除key中的空格以及非打印字符
filtered_text = "".join(
Expand Down
4 changes: 3 additions & 1 deletion tianditu-tools/tiandituPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def get_map_uri(url: str, zmin: int = 0, zmax: int = 18, referer: str = "") -> s
Returns:
str: 瓦片地图uri
"""
url_quote = requests.utils.quote(url, safe=":/")
# ?" 进行 URL 编码后, 在 3.34 版本上无法加载地图
# "&"是必须要进行 url 编码的
url_quote = requests.utils.quote(url, safe=":/?=")
uri = f"type=xyz&url={url_quote}&zmin={zmin}&zmax={zmax}"
if referer != "":
if current_qgis_version >= 32600:
Expand Down

0 comments on commit 19e5f7a

Please sign in to comment.