IconLayer problem
In my project ,a event to make dots. so I want use IconLayer to achieve the effect. I refer to the example IconLayer. in the code ,I copy 'icon-cluster-layer.js' file in my project in layer
new IconClusterLayer({
data: RankListData,
wrapLongitude: true,
getPosition: d => d.location,
iconAtlas: require('../../images/rank_icon.png'),
iconMapping: require('../../data/rank-icon-mapping.json'),
sizeScale: 30,
id: 'icon-cluster'
}),
but the result is not quiet right,:
the yellow point maybe is the icon ,in console.
and in the line 97
how can I resolve this warn to show the right effect.
thank you .
@HeiYanjing
icon-cluster-layer.js is an example that uses standard core layer IconLayer. It basically projects icon position in screen space to group them into clusters. You may have to apply any changes to the icon-cluster-layer based on you data format and please compare all other required props.
The crash seem to be due to invalid data format, make sure data in your props is an array where each element contains coord array.
@HeiYanjing
icon-cluster-layer.jsis an example that uses standard core layerIconLayer. It basically projects icon position in screen space to group them into clusters. You may have to apply any changes to theicon-cluster-layerbased on you data format and please compare all other required props.The crash seem to be due to invalid data format, make sure data in your props is an array where each element contains
coordarray.
yes,I resolved it ,thank you
This is always because that the input data doesn't include property of coordinates. In icon-cluster-layer.js, the location of one point is fixed to be get from this key. See https://github.com/uber/deck.gl/blob/6.3-release/examples/website/icon/icon-cluster-layer.js#L97
const screenCoords = transform.project(p.coordinates);
Other developers may face the same problem when they need to modify the codes of this demo, I think abstract it to a user customized input property will be better, such as:
const User_Customized_Key_Name = props.User_Customized_Key_Name || 'coordinates';
const screenCoords = transform.project(p[User_Customized_Key_Name]);
:-)
@hijiangtao , please update to latest deck.gl version, and let us know if it is still relevant, if so please re open the bug, closed bugs are usually not monitored.
@1chandu Well, I can customize getPosition function right now, but it doesn't work in [email protected] or older versions. Thanks.