在重装前:
1、备份plugin
从拷贝并备份下面的文件夹:
**\QGIS\QGIS3\profiles\default\python\plugins
尤其看是否有下面2个底图插件: HCMGIS Quick map services
2、重装后:
2.1将QGIS界面改成中文
设置——选项——通用
2.2 拷贝plugin
将plugin文件夹拷贝入新的plugin文件夹(但对QGIS3.28不适用)
3.添加底图设置
3.1 在QGIS 浏览里的 ”WMS/WMTS“ 点右键添加:谢栋灿底图
3.2在QGIS 浏览里的 ”WFS“ 添加:天地图全国基础地理信息矢量数据
http://gisserver.tianditu.gov.cn/TDTService/wfs
3.3 在QGIS 浏览里的 ”ArcGisMapServer“ 添加:29种ArcGIS地图服务URL完整列表
方法:将下列代码存为xml格式并在”ArcGisMapServer“处右键导入:
<!DOCTYPE connections>
<qgsARCGISMAPSERVERConnections version="1.0">
<arcgismapserver referer="" name="ChinaBoundaryLine" authcfg="" url="https://map.geoq.cn/arcgis/rest/services/SimpleFeature/ChinaBoundaryLine/MapServer" password="" username=""/>
<arcgismapserver referer="" name="ChinaOnlineCommunity" authcfg="" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer" password="" username=""/>
<arcgismapserver referer="" name="ChinaOnlineCommunityENG" authcfg="" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunityENG/MapServer" password="" username=""/>
<arcgismapserver referer="" name="ChinaOnlineCommunity_Mobile" authcfg="" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity_Mobile/MapServer" password="" username=""/>
<arcgismapserver referer="" name="ChinaOnlineStreetGray" authcfg="" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetGray/MapServer" password="" username=""/>
<arcgismapserver referer="" name="ChinaOnlineStreetPurplishBlue" authcfg="" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer" password="" username=""/>
<arcgismapserver referer="" name="ChinaOnlineStreetWarm" authcfg="" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetWarm/MapServer" password="" username=""/>
<arcgismapserver referer="" name="DeLorme_World_Base_Map" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Specialty/DeLorme_World_Base_Map/MapServer" password="" username=""/>
<arcgismapserver referer="" name="NatGeo_World_Map" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/NatGeo_World_Map/MapServer" password="" username=""/>
<arcgismapserver referer="" name="USA_Topo_Maps" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/USA_Topo_Maps/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Boundaries_and_Places" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Reference/World_Boundaries_and_Places/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Boundaries_and_Places_Alternate" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Dark_Gray_Base" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Base/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Dark_Gray_Reference" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Reference/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Hillshade" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Hillshade_Dark" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade_Dark/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Imagery" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Light_Gray_Base" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Base/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Light_Gray_Reference" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Reference/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Navigation_Charts" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Specialty/World_Navigation_Charts/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Ocean_Base" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Ocean_Reference" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Physical_Map" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Reference_Overlay" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Reference/World_Reference_Overlay/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Shaded_Relief" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Street_Map" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Terrain_Base" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/World_Terrain_Base/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Topo_Map" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer" password="" username=""/>
<arcgismapserver referer="" name="World_Transportation" authcfg="" url="http://server.arcgisonline.com/arcgis/rest/services/Reference/World_Transportation/MapServer" password="" username=""/>
</qgsARCGISMAPSERVERConnections>
如果新安装的是QGIS3.28,会发现选项里没有 ”ArcGisMapServer“ 选项,则需要在在QGIS 浏览里的”ArcGis REST 服务器“ 添加:29种ArcGIS地图服务URL完整列表
方法:将下列代码存为xml格式并在”ArcGis REST 服务器““处右键导入:
<!DOCTYPE connections>
<qgsARCGISFEATURESERVERConnections version="1.0">
<arcgisfeatureserver password="" authcfg="" username="" name="ChinaBoundaryLine" url="https://map.geoq.cn/arcgis/rest/services/SimpleFeature/ChinaBoundaryLine/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="ChinaOnlineCommunity" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="ChinaOnlineCommunityENG" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunityENG/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="ChinaOnlineCommunity_Mobile" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity_Mobile/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="ChinaOnlineStreetGray" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetGray/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="ChinaOnlineStreetPurplishBlue" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="ChinaOnlineStreetWarm" url="https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetWarm/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="DeLorme_World_Base_Map" url="http://server.arcgisonline.com/arcgis/rest/services/Specialty/DeLorme_World_Base_Map/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="NatGeo_World_Map" url="http://server.arcgisonline.com/arcgis/rest/services/NatGeo_World_Map/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="USA_Topo_Maps" url="http://server.arcgisonline.com/arcgis/rest/services/USA_Topo_Maps/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Boundaries_and_Places" url="http://server.arcgisonline.com/arcgis/rest/services/Reference/World_Boundaries_and_Places/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Boundaries_and_Places_Alternate" url="http://server.arcgisonline.com/arcgis/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Dark_Gray_Base" url="http://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Base/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Dark_Gray_Reference" url="http://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Reference/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Hillshade" url="http://server.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Hillshade_Dark" url="http://server.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade_Dark/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Imagery" url="http://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Light_Gray_Base" url="http://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Base/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Light_Gray_Reference" url="http://server.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Reference/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Navigation_Charts" url="http://server.arcgisonline.com/arcgis/rest/services/Specialty/World_Navigation_Charts/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Ocean_Base" url="http://server.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Ocean_Reference" url="http://server.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Physical_Map" url="http://server.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Reference_Overlay" url="http://server.arcgisonline.com/arcgis/rest/services/Reference/World_Reference_Overlay/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Shaded_Relief" url="http://server.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Street_Map" url="http://server.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Terrain_Base" url="http://server.arcgisonline.com/arcgis/rest/services/World_Terrain_Base/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Topo_Map" url="http://server.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer" />
<arcgisfeatureserver password="" authcfg="" username="" name="World_Transportation" url="http://server.arcgisonline.com/arcgis/rest/services/Reference/World_Transportation/MapServer"/>
</qgsARCGISFEATURESERVERConnections>
3.4 批量导入xyz tiles图层:
把下面的python代码复制黏贴到右下角的python脚本窗口,然后点击运行即可
# Sources
sources = []
sources.append(["connections-xyz","Stamen Terrain", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/terrain/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Stamen Toner", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/toner/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Stamen Toner Light", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/toner-lite/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Stamen Watercolor", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/watercolor/%7Bz%7D/%7Bx%7D/%7By%7D.jpg", "", "18", "0"])
sources.append(["connections-xyz","Wikimedia Map", "", "", "OpenStreetMap contributors, under ODbL", "https://maps.wikimedia.org/osm-intl/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "1"])
sources.append(["connections-xyz","Wikimedia Hike Bike Map", "", "", "OpenStreetMap contributors, under ODbL", "http://tiles.wmflabs.org/hikebike/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "17", "1"])
sources.append(["connections-xyz","Esri Boundaries Places", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
sources.append(["connections-xyz","Esri Gray (dark)", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "16", "0"])
sources.append(["connections-xyz","Esri Gray (light)", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "16", "0"])
sources.append(["connections-xyz","Esri National Geographic", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "12", "0"])
sources.append(["connections-xyz","Esri Ocean", "", "", "", "https://services.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "10", "0"])
sources.append(["connections-xyz","Esri Satellite", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "17", "0"])
sources.append(["connections-xyz","Esri Standard", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "17", "0"])
sources.append(["connections-xyz","Esri Terrain", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "13", "0"])
sources.append(["connections-xyz","Esri Transportation", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
sources.append(["connections-xyz","Esri Topo World", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
sources.append(["connections-xyz","Open Street Map Standard", "", "", "OpenStreetMap contributors, CC-BY-SA", "http://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
sources.append(["connections-xyz","Open Street Map H.O.T.", "", "", "OpenStreetMap contributors, CC-BY-SA", "http://tile.openstreetmap.fr/hot/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
sources.append(["connections-xyz","Open Street Map Monochrome", "", "", "OpenStreetMap contributors, CC-BY-SA", "http://tiles.wmflabs.org/bw-mapnik/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
sources.append(["connections-xyz","Strava All", "", "", "OpenStreetMap contributors, CC-BY-SA", "https://heatmap-external-b.strava.com/tiles/all/bluered/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "15", "0"])
sources.append(["connections-xyz","Strava Run", "", "", "OpenStreetMap contributors, CC-BY-SA", "https://heatmap-external-b.strava.com/tiles/run/bluered/%7Bz%7D/%7Bx%7D/%7By%7D.png?v=19", "", "15", "0"])
sources.append(["connections-xyz","Open Weather Map Temperature", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "http://tile.openweathermap.org/map/temp_new/%7Bz%7D/%7Bx%7D/%7By%7D.png?APPID=1c3e4ef8e25596946ee1f3846b53218a", "", "19", "0"])
sources.append(["connections-xyz","Open Weather Map Clouds", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "http://tile.openweathermap.org/map/clouds_new/%7Bz%7D/%7Bx%7D/%7By%7D.png?APPID=ef3c5137f6c31db50c4c6f1ce4e7e9dd", "", "19", "0"])
sources.append(["connections-xyz","Open Weather Map Wind Speed", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "http://tile.openweathermap.org/map/wind_new/%7Bz%7D/%7Bx%7D/%7By%7D.png?APPID=f9d0069aa69438d52276ae25c1ee9893", "", "19", "0"])
sources.append(["connections-xyz","CartoDb Dark Matter", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "http://basemaps.cartocdn.com/dark_all/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","CartoDb Positron", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "http://basemaps.cartocdn.com/light_all/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Bing VirtualEarth", "", "", "", "http://ecn.t3.tiles.virtualearth.net/tiles/a{q}.jpeg?g=1", "", "19", "1"])
#new sources
sources.append(["connections-xyz","高德影像", "", "", "", "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}", "", "19", "1"])
sources.append(["connections-xyz","高德矢量", "", "", "", "http://webrd03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}", "", "19", "1"])
sources.append(["connections-xyz","高德路网(不含注记)", "", "", "", "https://wprd02.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=2&style=8", "", "19", "1"])
sources.append(["connections-xyz","高德路网(含注记)", "", "", "", "https://wprd02.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=8", "", "19", "1"])
sources.append(["connections-xyz","腾讯路网", "", "", "", "http://rt0.map.gtimg.com/tile?z={z}&x={x}&y={-y}&type=vector&styleid=3&version=628", "", "19", "1"])
sources.append(["connections-xyz","腾讯地图_街道(和真实坐标大约偏移1700米)", "", "", "", "http://rt0.map.gtimg.com/realtimerender?z={z}&x={x}&y={-y}&type=vector&style=0", "", "19", "1"])
#天地图
sources.append(["connections-xyz","球面墨卡托投影-矢量","","","","https://t3.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","球面墨卡托投影-矢量注记","","","","http://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","球面墨卡托投影-矢量英文注记","","","","http://t0.tianditu.gov.cn/eva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=eva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","球面墨卡托投影-影像","","","","http://t0.tianditu.gov.cn/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={z}&TileRow={y}&TileCol={x}&style=default&format=tiles&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","球面墨卡托投影-影像注记","","","","http://t0.tianditu.gov.cn/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={z}&TileRow={y}&TileCol={x}&style=default&format=tiles&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","球面墨卡托投影-影像英文注记","","","","http://t0.tianditu.gov.cn/eia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=eia&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","球面墨卡托投影-地形晕渲","","","","http://t0.tianditu.gov.cn/ter_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ter&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","球面墨卡托投影-地形晕渲注记","","","","http://t0.tianditu.gov.cn/cta_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cta&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","球面墨卡托投影-全球境界线","","","","http://t0.tianditu.gov.cn/ibo_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ibo&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","经纬度坐标系-矢量","","","","http://t0.tianditu.gov.cn/vec_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","经纬度坐标系-矢量注记","","","","http://t0.tianditu.gov.cn/cva_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","经纬度坐标系-矢量英文注记","","","","http://t0.tianditu.gov.cn/eva_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=eva&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","经纬度坐标系-影像","","","","http://t0.tianditu.gov.cn/img_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","经纬度坐标系-影像注记","","","","http://t0.tianditu.gov.cn/cia_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","经纬度坐标系-影像英文注记","","","","http://t0.tianditu.gov.cn/eia_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=eia&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","经纬度坐标系-地形","","","","http://t0.tianditu.gov.cn/ter_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ter&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","经纬度坐标系-地形注记","","","","http://t0.tianditu.gov.cn/cta_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cta&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
sources.append(["connections-xyz","经纬度坐标系-全球境界线","","","","http://t0.tianditu.gov.cn/ibo_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ibo&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=ec899a50c7830ea2416ca182285236f3","","19","1"])
# Add sources to browser
for source in sources:
connectionType = source[0]
connectionName = source[1]
QSettings().setValue("qgis/%s/%s/authcfg" % (connectionType, connectionName), source[2])
QSettings().setValue("qgis/%s/%s/password" % (connectionType, connectionName), source[3])
QSettings().setValue("qgis/%s/%s/referer" % (connectionType, connectionName), source[4])
QSettings().setValue("qgis/%s/%s/url" % (connectionType, connectionName), source[5])
QSettings().setValue("qgis/%s/%s/username" % (connectionType, connectionName), source[6])
QSettings().setValue("qgis/%s/%s/zmax" % (connectionType, connectionName), source[7])
QSettings().setValue("qgis/%s/%s/zmin" % (connectionType, connectionName), source[8])
# Update GUI
iface.reloadConnections()
参考: