-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Motivation
The new featureset concept is pretty clean as a way to curate an API for imported styles. But of course, it comes with the tradeoff that developers can't just mess with whatever they want anymore, and so it limits the things we can build.
In my particular case, I want to render each building on the map with a specific color. We're a general dataviz provider but an example would be each building having a color based on median rental price for a listing platform.
I used to do this with an extruded OSM building layer and a color feature state. I'm trying to upgrade to Standard and this is a blocker.
I see colorBuildingHighlight and colorBuildingSelect which basically do what I need but they're just 2 colors driven by boolean feature states. Could we add a string feature state to have any color at all?
Related question: do colorBuildingHighlight and colorBuildingSelect work on the new building models? It would be good if they did, since "classic" 3d buildings and "model based" 3d buildings are pretty much the same thing for a non-tech user and having a different behavior would make features based on this feature more difficult to roll out. I think this is especially true since you could replace a "classic" 3d buildings by a "model based" one anytime if I understand that well (this is super cool by the way).
Design Alternatives
Stick to old Mapbox to be able to color any building freely 💔.
Design
- Add a feature state for
color(I guess a less conflict-prone name)
Mock-Up
Devs (just for testing by clicking a building and setting a random color):
map.addInteraction('buildings-click-interaction', {
type: 'click',
target: { featuresetId: 'buildings', importId: 'basemap' },
handler: (e) => {
map.setFeatureState(e.feature, { color: '#ff0000' }) // a beautiful red
},
})Users: a city with buildings in data-driven colors.