Icon Layer Not Rendering
I am trying to create an Icon Layer with a png icon, however the layer is not rendering. I have done some debugging and found that the IconLayer render function is only accessing the first point in the dataset, and even that point is not getting rendered. There are also no error messages thrown so I have no idea where to look for the problem.
I have attached my data file, app.js and deckgl-overlay.js files.
const layers = [
new IconLayer({
id: 'icon-layer',
getPosition: d => {d.position; console.log(d)}, //this log is only triggered once. should be triggered for every point in dataset
getColor: d => [255, 0, 128],
getAngle: d => d.heading,
getIcon: d => d.icon,
iconAtlas: this.props.iconAtlas,
iconMapping: ICON_MAPPING,
sizeScale: 1,
opacity: 1,
pickable: true,
radiusMinPixels: 2,
radiusMaxPixels: 30,
visible: true,
...this.props
})
]
While this is presumably not your main issue, as far as I can tell, there is no return value from this statement
getPosition: d => {d.position; console.log(d)}
The resulting undefined position should trigger either an exception or a NaN attribute warning/error.
The fact that you are not seeing anything in the browser console is strange. Maybe try different browser, just to double check?
As Ib pointed out the real bug is getPosition returning undefined, you either need a explict return statement or replace {...} with single statement.
Also note LayerManager._initializeNewLayer caches exceptions prints error logs. Make sure you don't have any filters on log messages. I confirmed on Chrome, it does throw errors.
@ibgreen you're right about the return statement, after adding it, all of the points were accessed. However, the layer is still not being rendered. Could it be the png I am using? I notice in all the documentation/examples it is referred to as an AtlasImage. I am just using a .png icon with nothing special about it, is that the issue?

@mtholdefer, your .png looks fine. Atlas is normally referred to a single image that contains textures for multiple images and are referred using specific x,y offsets. But you have one image and your offsets looks good too.
One thing I noticed you don't have getSize, it should still be fine as it uses defaults value, but good thing to try specifying oe, also increase the sizeScale if the objects are too small, and compare with example code in examples/icon.
The getSize missing was what was keeping it from rendering. Thanks!
I believe this is not the first time someone has had this issue. Maybe we should add a minPixelSize type prop to prevent icons from becoming invisible with default settings?