Are all deck.gl layer types supported?

Hi, I had a blast with Streamlit over the weekend! Thanks for making this available as Open Source :slight_smile:

I am trying to get either PolygonLayer and/or GeoJsonLayer working (I already have ScatterplotLayer working), but in both cases I get an error saying that the layer is not supported, just don’t know where it comes from.

The error is below, and the source code that triggers follows it.

Am I missing something or this is to be implemented? Is the data supposed to be a dataframe too? if so, what’s the right format?

Error: Unsupported layer type "geojsonlayer"

value/<@http://localhost:8502/static/js/20.7c756591.chunk.js:1:3846
tr</o.prototype.map/<@http://localhost:8502/static/js/7.98b70499.chunk.js:1:98766
Tt@http://localhost:8502/static/js/7.98b70499.chunk.js:1:88251
tr</o.prototype.map@http://localhost:8502/static/js/7.98b70499.chunk.js:1:98705
...
e/<@http://localhost:8502/static/js/main.e804509a.chunk.js:1:50185
l@http://localhost:8502/static/js/7.98b70499.chunk.js:1:1247205
u/i._invoke</<@http://localhost:8502/static/js/7.98b70499.chunk.js:1:1246994
x/</e[t]@http://localhost:8502/static/js/7.98b70499.chunk.js:1:1247627
n@http://localhost:8502/static/js/7.98b70499.chunk.js:1:48998
s@http://localhost:8502/static/js/7.98b70499.chunk.js:1:49201

the code used is more or less this:

   vp_layer = {'type':'GeoJsonLayer',
                'data':{
                    "type": "FeatureCollection",
                    "features": [
                        {
                            "type": "Feature",
                            "properties": {},
                            "geometry": {
                                "type": "Polygon",
                                "coordinates": [
                                    [
                                        [
                                            -122.5312042236328,
                                            37.71859032558816
                                        ],
                                        [
                                            -122.3495864868164,
                                            37.71859032558816
                                        ],
                                        [
                                            -122.3495864868164,
                                            37.8065289741725
                                        ],
                                        [
                                            -122.5312042236328,
                                            37.8065289741725
                                        ],
                                        [
                                            -122.5312042236328,
                                            37.71859032558816
                                        ]
                                    ]
                                ]
                            }
                        }
                    ]
                },
                #'getPolygon':[tl,tr,br,bl,tr],
                # 'stroked':True,
                # 'wireframe':True
                'getLineColor': [80, 80, 80],
                'getLineWidth': 1,}
...
    st.deck_gl_chart(viewport={'latitude':(viewport[0]+viewport[2])/2,
                               'longitude':(viewport[1]+viewport[3])/2,
                               'zoom':bbox['zoom']-2,
                               'width':width,
                               'height':height},
                     layers=[vp_layer])

I have only been able to get a few layers working. Hexagon, Scatterplot, Text, Line, Arc. I’ll be watching this question to see if there is a list of layers that are supported.

Hi @tbatchelli and @dbgriffith01

Right now only the following layers are supported:

  • ArcLayer
  • GridLayer
  • HexagonLayer
  • LineLayer
  • PointCloudLayer
  • ScatterplotLayer
  • ScreenGridLayer
  • TextLayer

We’d love to support more layers, but the biggest obstacle for that is actually coming up with a good Python API for them. So when @tbatchelli asks “Is the data supposed to be a dataframe too? if so, what’s the right format?”, that is exactly the kind of question we’re asking ourselves here! :grin:

Based on this thread, I’m creating two issues in our tracker:

  1. Short-term fix: add support for DeckGL GeoJsonLayer
  2. Possible long-term fix: Make deck_gl_chart use DeckGL JSON spec. This would allow Streamlit to support all DeckGL features (I think. It’s unclear whether they’re all supported in the DeckGL JSON spec…)

I would add 3. Update docs to indicate which layers are currently supported :slight_smile:

Good point. Will do!