Skip to content

Commit

Permalink
Fix small error
Browse files Browse the repository at this point in the history
  • Loading branch information
yellow-sky committed May 26, 2016
1 parent a0f283f commit 5e110ca
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/qgis_map_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from py_tiled_layer.tiles import TileServiceInfo
from py_tiled_layer.tilelayer import TileLayer

service_layers = []

def tr(message):
# noinspection PyTypeChecker,PyArgumentList,PyCallByClass
Expand Down Expand Up @@ -88,17 +89,17 @@ def add_layer_to_map(ds):
# Set attribs
layer.setAttribution(ds.copyright_text)
layer.setAttributionUrl(ds.copyright_link)
# Insert to bottom if wms\tms
# Insert layer
toc_root = QgsProject.instance().layerTreeRoot()
if ds.type.lower() in (KNOWN_DRIVERS.WMS.lower(), KNOWN_DRIVERS.TMS.lower()):
QgsMapLayerRegistry.instance().addMapLayer(layer, False)
toc_root = QgsProject.instance().layerTreeRoot()
toc_root.insertLayer(len(toc_root.children()), layer)
position = len(toc_root.children()) # Insert to bottom if wms\tms
else:
# insert to top
QgsMapLayerRegistry.instance().addMapLayer(layer, True)
position = 0 # insert to top
QgsMapLayerRegistry.instance().addMapLayer(layer, False)
toc_root.insertLayer(position, layer)

# Save link
# !!!! self.service_layers.append(layer)
service_layers.append(layer)
# Set OTF CRS Transform for map
if PluginSettings.enable_otf_3857() and ds.type == KNOWN_DRIVERS.TMS:
iface.mapCanvas().setCrsTransformEnabled(True)
Expand Down

0 comments on commit 5e110ca

Please sign in to comment.