Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Null Values in Data Driven Styles #9037

Closed
hjbdev opened this issue Nov 28, 2019 · 1 comment
Closed

Allow Null Values in Data Driven Styles #9037

hjbdev opened this issue Nov 28, 2019 · 1 comment

Comments

@hjbdev
Copy link

hjbdev commented Nov 28, 2019

Motivation

I'm importing GeoJSON into a mapbox map, I have two data sets, lines and points. My lines require different styling based on criteria in the properties in the GeoJSON.

For line-color, the data driven properties work fine. My issue is that some of my lines need a border/outline on, so to resolve this I'm using a repeatable pattern. However, I only want this to be on certain lines, not all. I thought that maybe adding null as the default would achieve this, however it doesn't. line-pattern overrides line-color, which would be fine if I could null the pattern when I want the color, but I can't.

I'd like to avoid making two sets of GeoJSON just for lines, it'll get quite unwieldy.

Design Alternatives

Allow a null value in data driven styles, which would equivalate to not having a value there at all for that specific map feature.

Mock-Up

To a developer this would look similar to the below:

paint: {
    'line-color': [
        'match', ['get', 'my_property'],
        'outline_please', 'my-outline-style',
        null // this is the default
    ]
}

Implementation

Don't think too much would have to change in order to implement this but I'm not particularly familiar with the source code for Mapbox GL so I could be wrong here.

@asheemmamoowala
Copy link
Contributor

@hjbdev Thanks for opening this request. I am closing this because it is a duplicate of #8331. A work-around has been posted at #8331 (comment) until this functionality is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants