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

Expression generating black styles with nested objects. #7620

Closed
rebz opened this issue Nov 26, 2018 · 1 comment
Closed

Expression generating black styles with nested objects. #7620

rebz opened this issue Nov 26, 2018 · 1 comment

Comments

@rebz
Copy link

rebz commented Nov 26, 2018

The example provided is not my original code, just a mini-version that is similar to how I am loading data and attempting to style.

mapbox-gl-js version: 0.51.0

browser: Chrome Version 70.0.3538.110 (Official Build) (64-bit) on MacOS

Steps to Trigger Behavior

  1. Please view the CodeSandbox Source link below.
  2. Open the file /components/SourceLayer.vue
  3. Notice the expressions used for styling against a nested property pcp.Zip.

Link to Demonstration

  1. CodeSandbox Source for a view of the source code.
  2. CodeSandbox Web View to view just the web output.

Things to Note

I am importing a CSV file, then importing a Geojson file, then joining the CSV columns into the relative Geojson feature props. Once complete, I store this in a variable and reference that as a map source. You can see this taking place in App.vue on CodeSandbox.

Not sure if this is an actual bug or me not understanding how expressions work. My apologies if the latter as I'm brand-spanking new to Mapbox. Appreciate any insight or help on understanding this.

Expected Behavior

Each feature.properties should contain an object under the key pcp. I should see precincts (features) on the map highlighted green if their feature.properties.pcp.Zip has a value. At most their fill-opacity should be set to 1. When I hover over a feature it should turn from green with an opacity of 1 to the color blue with an opacity of 0.5.

Actual Behavior

Some features gain the correct green color, but a cluster of features in the center have a color of black. Also, once a user leaves a feature (mouseout), instead of reverting back to the color green from blue, it appears to change to black with an opacity of 1. Neither of these effects are intended.

The "cluster of black features" in the middle of the map is not something I experienced until I tried to replicate my project in CodeSandbox to show on here. Below is a screenshot of my project on my local machine where I am only experiencing the post-hover issue.
image

@mourner
Copy link
Member

mourner commented Nov 26, 2018

Unfortunately nested property values aren't currently supported — it's a tough technical challenge. Some more background in #2434 — let's close this one as a duplicate.

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