🍺 Thanks http://cecilialiao.com/2014/10/30/adding-additional-stamen-map-tiles-to-qgis-2-4-tutorial/
I、 Install QGIS
visit Official Site download
II、 Install Openlayers Plugin
under Plugins menu, click Manage and Install Plugins
III、Custom Basemap
Setp1 edit osm_stamen.py
open folder .qgis2
in your pc. Windows: C:\Users\(computer name)\.qgis2
if you used default installation;
Mac OS X: ~/.qgis2
open .qgis2
edit python/plugins/openlayers_plugin/weblayers/osm_stamen.py
in last line add.
class OlOSMAutoNavLayer(OlOSMStamenLayer):
def __init__(self):
OlOSMStamenLayer.__init__(self, name='AutoNav/OSM', html='autonav.html')
Step2 define new html for custom basemap
In python/plugins/openlayers_plugin/weblayers/html/
copy stamen_toner.html
as autonav.html
and edit following part
var apple = new OpenLayers.Layer.XYZ(
"AutoNav/OSM map",
"http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x=${x}&y=${y}&z=${z}",
{
sphericalMercator: true,
wrapDateLine: true,
// TODO: min zoom level 2
numZoomLevels: 20,
// attribution: "", // FIXME: attribution
eventListeners: {
"loadstart": layerLoadStart,
"loadend": layerLoadEnd
}
}
);
🎈Reminder: ${x} ${y} ${z} NOT {x} {y} {z}
Step3 link new map to open layers plugin
edit python/plugins/openlayers_plugin/openlayers_plugin.py
Find following
from weblayers.osm_stamen import OlOSMStamenTonerLayer, OlOSMStamenWatercolorLayer, OlOSMStamenTerrainLayer
Update to
from weblayers.osm_stamen import OlOSMStamenTonerLayer, OlOSMStamenWatercolorLayer, OlOSMStamenTerrainLayer, OlOSMAutoNavLayer
Find
self._olLayerTypeRegistry.register(OlOSMStamenTerrainLayer())
In next line add
self._olLayerTypeRegistry.register(OlOSMAutoNavLayer())