I add OpenStreetMap 3D Buildings as a SceneLayer, but would like to set a Visual Variable to set the color of the fill based on a value I have from another data source. My other data source simply has the OSMID of the building (which matches the OSMID in the SceneLayer data) and a value (1–100). How can I join these two data sources together on the fly so that the value attribute is available to a visual variable?
Unfortunately this is not possible at this point using scene layers. Unlike related feature layers, the attribute values used for rendering scene layers are baked into the scene layer cache for performant loading and visualization. Because of that, it is not possible to join scene layers on the fly with an additional feature layer.
You can provide additional attribute values for example in the popup when highlighting a specific building if that helps your scenario. I would also be interested in how many buildings your additional data source covers, depending on that there might be other workarounds.
We've received this request before and are looking into possible solutions, however I am not able to provide a timeline for this.
Ok, thanks for the info. Right now I have ~250 buildings in one town in my data source. The hope is to allow the researcher I’m building this for to add to the data in the future. We’ll hope for a solution in the future to do this dynamically.
As a workaround, if I could calculate a color for a value against a ramp, I could loop through the data and addUniqueValueInfo for each item. I can’t find a function to calculate the color, so I’m trying to manually do that.
Indeed, this is one of the workarounds that might work. I would have to check what the limit on number of unique value infos is for a renderer. We do have some utilities to derive color or symbology, see for example https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-support-symbolUtils.html#...
One other approach is looping through the data as you describe and generating an Arcade expression out of it. You could then return each value for a given $feature.OSMID and use it in a ClassBreaksRenderer.valueExpression. Again, I'm not sure what the limit on the size of an Arcade expressions is. Let me know if anything is unclear and I am happy to provide a sample!
I forwarded the request to the team and will let you know here should we improve the support for this in the API.