Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] #7319: Add support for filters in map.queryRenderedFeatures #8178

Closed

Conversation

asheemmamoowala
Copy link
Contributor

Implemented support for filters in map.queryRenderedFeatures. This change allows providing layerIDs and/or Filters to the query method for filtering features. It supports the same basic Filter predicates as Layer filters.

This breaks a core API and needs additional work on the mobile SDK bindings

Usage:

QueryOptions options;
options.layerIDs  = {{ "layer1", "layer2"}};
EqualsFilter eqFilter = { "myKey", "myValue" };
options.filter = eqFilter;
map.queryRenderedFeatures({ [0.0, 1.0] }, options); 

Development Notes:
An existing QueryParameters struct was used internally in the SDK to pass the query related parameters down from the API. This change required adding parameters to the existing API method, and I chose to refactor the existing implementation to

  • use a single QueryOptions struct for all query related options
  • remove the internal QueryParameters struct and replace it with QueryOptions
    The net result is that the API has a clean signature with a first class options struct, and the internal plumbing continues to use this directly. Additional context needed for performing queries is maintained as separate method arguments since those are likely to change less than the query options.

Testing & Verification:
This PR has been verified with unit tests. I've also updated the node bindings to be able to call new integration tests added to mapbox-gl-js in this PR

As part of the verification I've also updated the macosapp bindings. iOS and Android bindings need to be updated.

The performance of the filtering has not yet been benchmarked, and needs more work.

@mention-bot
Copy link

@asheemmamoowala, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @ansis and @1ec5 to be potential reviewers.

@jfirebaugh jfirebaugh closed this Feb 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants