map.on('click', function (e) {
var point = e.layerPoint;
var hitLayers = [];
for (var dataId of layerVectorTile.keys()) {
var layer = layerVectorTile.get(dataId);
if (!layer) {
continue;
}
var layerGroup = {
dataId: dataId,
layers: []
};
for (var i in layer._vectorTiles) {
var tile = layer._vectorTiles[i];
var _point = point.subtract(tile.getOffset());
for (var j in tile._layers) {
if (tile._layers[j]._containsPoint(_point)) {
layerGroup.layers.push(tile._layers[j]);
}
}
}
if (layerGroup.layers.length > 0) {
hitLayers.push(layerGroup);
}
}
console.log(hitLayers);
});