-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
getLayer returns a layer but queryRenderedFeatures given a layer returns empty #4375
Comments
It can be, when:
Note that @Carpetfizz Are you sure that there is a feature from that layer in the current view, when you do the query? a test case would be useful here. |
I see a feature on my map, and the Could it possibly be an async issue? |
@Carpetfizz Can you provide a minimal, self-contained example that demonstrates the issue? |
@jfirebaugh @peterqliu here's a small demo where the bug occurs: |
Adding a layer is an asynchronous operation with respect to |
I've added a few layers to the map and now I want to extract some features from it. I've made sure the layer exists by using this call
console.log(this.map.getLayer(focus_key+"-point"));
which prints:
t {id: "8b4bc65b-4f60-43fd-bcde-fa63fa936479-point", metadata: undefined, type: "circle", source: "8b4bc65b-4f60-43fd-bcde-fa63fa936479", sourceLayer: undefined…}
Right after, I want to get all the features in the layer so I'm calling:
console.log(this.map.queryRenderedFeatures({layers: [focus_key+"-point"]}));
This returns an empty array
[]
.How can it be that the layer exists but querying for a feature in that layer, returns empty?
The text was updated successfully, but these errors were encountered: