Deck.gl: pydeck IconLayer doesn't appear

Created on 19 Nov 2019  路  7Comments  路  Source: visgl/deck.gl

Hi, I treid to draw Icon Layer. but doesn't appear

here is what i did

image

and the result was

image

anything didn't appear...

is there something wrong in my code..?!
I already checked that my icon png file was in valid directory.
and there were not any script errors...

bug question

Most helpful comment

Modifying an example from Streamlit:

import pydeck as pdk
import pandas as pd

icon_data = {
    "url": "https://img.icons8.com/plasticine/100/000000/marker.png",
    "width": 128,
    "height":128,
    "anchorY": 128
}
data = pd.read_json("https://raw.githubusercontent.com/uber-common/deck.gl-data/master/website/bart-stations.json")
data['icon_data']= None
for i in data.index:
     data['icon_data'][i] = icon_data

view_state = pdk.ViewState(
    longitude=-122.22,
    latitude=37.76,
    zoom=9,
    pitch=50
)

icon_layer = pdk.Layer(
    type='IconLayer',
    data=data,
    get_icon='icon_data',
    get_size=4,
    pickable=True,
    size_scale=15,
    get_position='coordinates'
)
tooltip = {
   "html": "<b>Address:</b> {address} <br/> <b>Station:</b> {name}",
   "style": {
        "backgroundColor": "steelblue",
        "color": "white"
   }
}
r = pdk.Deck(layers=[icon_layer], initial_view_state=view_state, tooltip=tooltip)
r.show()

Works in pydeck 0.2.0, which was released two days ago.

image

All 7 comments

Thanks for the bug report! I'm investigating this. Currently I think that the IconLayer is indeed broken in pydeck. I'll see if I can either make a recommendation for your code here or put out a patch.

I'll have to put out a patch for this. I'll update this issue when it's done.

Modifying an example from Streamlit:

import pydeck as pdk
import pandas as pd

icon_data = {
    "url": "https://img.icons8.com/plasticine/100/000000/marker.png",
    "width": 128,
    "height":128,
    "anchorY": 128
}
data = pd.read_json("https://raw.githubusercontent.com/uber-common/deck.gl-data/master/website/bart-stations.json")
data['icon_data']= None
for i in data.index:
     data['icon_data'][i] = icon_data

view_state = pdk.ViewState(
    longitude=-122.22,
    latitude=37.76,
    zoom=9,
    pitch=50
)

icon_layer = pdk.Layer(
    type='IconLayer',
    data=data,
    get_icon='icon_data',
    get_size=4,
    pickable=True,
    size_scale=15,
    get_position='coordinates'
)
tooltip = {
   "html": "<b>Address:</b> {address} <br/> <b>Station:</b> {name}",
   "style": {
        "backgroundColor": "steelblue",
        "color": "white"
   }
}
r = pdk.Deck(layers=[icon_layer], initial_view_state=view_state, tooltip=tooltip)
r.show()

Works in pydeck 0.2.0, which was released two days ago.

image

im having some issue as well. when i use a URL, it works fine, but when i try to use a local png file, nothing is shown.

is pydeck not working with the pre-packed iconAtlas option in the iconLayer?

@tamir-jether Thanks for reaching out! Can you file a new issue and include source code? It will be easier for me to replicate the error and fix it.

I'm having the same problem. At first it worked, but when I tried to display another image (using URL as well), the icon doesn't show.

@pipesalas @tamir-jether You can subscribe to #4625, where I'll be working on this. Give me a few weeks.

Was this page helpful?
0 / 5 - 0 ratings