Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: Custom Layer is Not Displaying on Map #2879

Open
Daim-Nickel-Penny opened this issue Dec 31, 2024 · 4 comments
Open

Issue: Custom Layer is Not Displaying on Map #2879

Daim-Nickel-Penny opened this issue Dec 31, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@Daim-Nickel-Penny
Copy link

My goal is to add a custom layer which returns a deck.gl layer and can be shown on map. So far I created the custom layer class (located in src/layers/src/custom-layer) that extends the Layer class and includes basic getter methods such as layerIcon, type, and renderLayer.

The renderLayer function returns a deck.gl BitmapLayer as per the deck.gl documentation (BitmapLayer Docs). Example implementation:

renderLayer() {
  return [
    new BitmapLayer({
      id: `${this.id}-bitmap-layer`,
      bounds: [-122.519, 37.7045, -122.355, 37.829],
      image:
        'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-districts.png',
      pickable: true,
    }),
  ];
}

The custom layer is properly imported and registered in layers/index.ts and layers.ts with all required constants and types and can be seen in the drop-down.

Issue

When this layer is selected in the demo app:

  • I added one log in constructor of the Custom Layer class and it logs confirming that the layer is mounted.
  • However, the layer does not render on the map. (assuming the renderLayer as seen above returns deck.gl's code)

Requests

  • Are there any specific steps or documentation on adding custom layers (e.g., image layers) to kepler.gl?
  • Is there a known issue or additional configuration required to render custom layers?
@Daim-Nickel-Penny Daim-Nickel-Penny added the bug Something isn't working label Dec 31, 2024
@AlfredoRuizXcaliburmp
Copy link

renderLayer es de Deck.gl, no de Kepler.gl.

@igorDykhta igorDykhta self-assigned this Jan 7, 2025
@igorDykhta
Copy link
Collaborator

Here is an example of a custom layer, but the PR is huge: vector tile layer alpha version
I ran some tests to render TileLayer and BitmapLayer and everything worked as expected.

Something is wrong with your setup, but it's hard to tell what without access to your code.

@simonprovost
Copy link

@Daim-Nickel-Penny Any news?

@simonprovost
Copy link

simonprovost commented Feb 6, 2025

@igorDykhta

Given the length of the PR, could we please get some guidance on how to create a new layer type? Specifically, we're looking to define a new layer type that would allow us to display only the points that start within the drawn polygon A and end in the drawn polygon B, i.e.

  • The start position (start_longitude and start_latitude) originates from polygon A.
  • The end position (end_longitude and end_latitude) terminates at polygon B.

I haven't found documentation on customising or creating new layer types—am I missing something?

For filtering points (i.e. the query aforementioned), I believe DuckDB handles this well (I tested in a side project without any issues). However, in Kepler, it would be useful to understand how to create custom layers. This isn't necessarily for a mainline contribution but for more localised use cases that could support larger projects while we would be leveraging the Kepler React component.

PS: Maybe @heshan0131 too? I saw you a couple of time answering around similar topics :)

Cheers :) !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants