1

As the title indicate, How to make 'hybrid' satellite layer be able to switch on/off after exporting?

All other layers have blue ticked box to switch on/off. Only hybrid layer does not have it.

Is there any setting that I missed out? img

  • Can you give more details about the 'hybrid' layer? Is it a raster layer? XYZ Tiles? Where did the layer come from? How did you load it into Qgis? – GreyHippo Sep 14 at 18:21
  • Also what format are you exporting, OpenLayers, Leaflet, Mapbox? – GreyHippo Sep 14 at 18:23
  • Hi ~@GreyHippo 'hybrid' layer came from Google map - source: hatarilabs.com/ih-en/how-to-add-a-google-map-in-qgis-3-tutorial I exported as OpenLayers format. – Andy Yang Sep 14 at 22:44
2

The 'hybrid' layer has a layer type set to 'base'. The plugin does not allow you to change the layer type setting so you will have to edit the output javascript file layers.js that was created by the plugin. The file is located in the layers folder. You will need to edit the section that defines the google map layer by commenting out the 'type' line by adding two forward slashes. Your section should look similar to mine below.

Code:

var lyr_OpenStreetMap_0 = new ol.layer.Tile({
            'title': 'OpenStreetMap',
            //'type': 'base',
            'opacity': 1.000000,
             source: new ol.source.XYZ({
                 attributions: ' ',
                 url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
              })
        });

Save your edits then refresh the page and you should be able to turn the layer on and off.

| improve this answer | |
  • Thanks a lot! This is exactly what I want to achieve. :) – Andy Yang Sep 16 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.