TransWikia.com

Qgis2web - how to make 'hybrid' satellite layer be able to switch on/off after exporting?

Geographic Information Systems Asked by Andy Yang on January 15, 2021

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

One Answer

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.

Correct answer by GreyHippo on January 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP