deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

IconLayer obscured by buildings

Open HeiYanjing opened this issue 8 years ago • 4 comments

firstly I refer to the example iconlayer in my project. and I achieve effect like this image the icon show correctly. the building show 3D effect, so , there is a problem in the web page, in larger scale. image Icons blend with buildings . so ,can icons suspended in the air or buildings ?

HeiYanjing avatar Oct 09 '18 11:10 HeiYanjing

You may either:

  • Add an altitude ([long, lat, z]) to the position of each icon
  • Disable depth testing by passing parameters: {depthTest: false} to the IconLayer

Pessimistress avatar Oct 09 '18 18:10 Pessimistress

You may either:

  • Add an altitude ([long, lat, z]) to the position of each icon
  • Disable depth testing by passing parameters: {depthTest: false} to the IconLayer

thank you for your reply . I add altitude when I handle the coordinate. , I set altitude 80,and it works, image icons like ballon suspend above the buildings .but there is another question the buildings PolygonLayer still overlaps with the IconClusterLayer。Because buildings datas and icon coordinate datas are independent of each other。so ,Is it possible to set up active avoidance buildings?

HeiYanjing avatar Oct 10 '18 06:10 HeiYanjing

If you mean making the icons automatically avoid the buildings... that would be very difficult. You can try setting a larger z value, then draw a vertical line from the bottom of each icon to the ground to provide some visual reference:

image

If you are using the IconClusterLayer from our example, you can do this by modifying the renderLayers method:

return [
  // the same IconLayer
  new IconLayer(...),

  // new
  new LineLayer(
      this.getSubLayerProps({
        id: 'line',
        data,
        getSourcePosition: getPosition,
        getTargetPosition: d => {
          const p = getPosition(d);
          return [p[0], p[1], 0];
        },
        getColor: [255, 255, 255],
        getStrokeWidth: d => d.zoomLevels[z] ? 1: 0,
        updateTriggers: {
          getStrokeWidth: {version, z}
        }
      })
    );
];

Pessimistress avatar Oct 17 '18 03:10 Pessimistress

@Pessimistress Thank you for you reply. and you can understand what I said

HeiYanjing avatar Oct 18 '18 02:10 HeiYanjing