Currently, the Nearby widget will auto populate all layers and sublayers (with data) listed in the viewer.js. Could we change the code so that we could have more control over which layers we include in the Nearby widget? From the Nearby.js file it seems this function creates the drop-down list:
populateLayerSelect: function () { var options = []; array.forEach(this.map.layerIds, lang.hitch(this, function (layerId, i) { if (i !== 0) { if (this.map.getLayer(layerId).layerInfos && this.map.getLayer(layerId).layerInfos.length > 0) { array.forEach(this.map.getLayer(layerId).layerInfos, lang.hitch(this, function (layerInfo, j) { // check to exclude the group layers as they do not contain features if (!layerInfo.subLayerIds) { options.unshift({ value: layerId + ':' + j, label: layerInfo.name }); } })); } else if (this.map.getLayer(layerId).name) { options.unshift({ value: layerId + ':', label: this.map.getLayer(layerId).name }); } } })); this.nearbyFeaturesSelect.addOption(options); this.setupSelectionLayers(this.nearbyFeaturesSelect.get('value')); },
Any quick pointers on how we might approach this would be helpful. If it would be a complex task, that insight would also be helpful. Thank you!
Currently, the Nearby widget will auto populate all layers and sublayers (with data) listed in the viewer.js. Could we change the code so that we could have more control over which layers we include in the Nearby widget? From the Nearby.js file it seems this function creates the drop-down list:
populateLayerSelect: function () { var options = []; array.forEach(this.map.layerIds, lang.hitch(this, function (layerId, i) { if (i !== 0) { if (this.map.getLayer(layerId).layerInfos && this.map.getLayer(layerId).layerInfos.length > 0) { array.forEach(this.map.getLayer(layerId).layerInfos, lang.hitch(this, function (layerInfo, j) { // check to exclude the group layers as they do not contain features if (!layerInfo.subLayerIds) { options.unshift({ value: layerId + ':' + j, label: layerInfo.name }); } })); } else if (this.map.getLayer(layerId).name) { options.unshift({ value: layerId + ':', label: this.map.getLayer(layerId).name }); } } })); this.nearbyFeaturesSelect.addOption(options); this.setupSelectionLayers(this.nearbyFeaturesSelect.get('value')); },
Any quick pointers on how we might approach this would be helpful. If it would be a complex task, that insight would also be helpful. Thank you!