maptalks / issues

Repo of issues for webgl layers
2 stars 0 forks source link

加入地形后的点击事件问题 #672

Open Yaoyouquan opened 2 months ago

Yaoyouquan commented 2 months ago

maptalks: "1.0.0-rc.26" maptalks/gl-layers: "0.27.3"

在用如下方式加入地形后

const terrain = {
  tileSystem: [1, 1, -180, -90],
  zoomOffset: -1,
  maxAvailableZoom: 14,
  type: 'cesium',
  terrainWidth: 65,
  urlTemplate: 'http://***.***.**.**:****/sdgis/SD_DEM/{z}/{x}/{y}.terrain',
  shader: 'lit',
}
groupLayer = new GroupGLLayer("groupLayer", layers, { terrain, sceneConfig }).addTo(map);

点击GeoJSONVectorTileLayer无法获取到点击的geos,后续操作没法实现。请教一下这种情况如何处理?

map.on("click", function (e) {
  let layers = [];
  let glLayers = groupLayer.getLayers();
  glLayers.forEach(layer => {
    if (layer instanceof GeoJSONVectorTileLayer || layer instanceof PointLayer) {
      layers.push(layer)
    }
  })
  map.identify({ coordinate: e.coordinate, layers: layers }, geos => {
    console.log("geos", geos)
  })
})
fuzhenn commented 2 months ago

目前地形上的vt确实还没支持点击事件的支持