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

MGLSymbolStyleLayer predicate option change #12259

Closed
JamieJeon opened this issue Jun 29, 2018 · 5 comments
Closed

MGLSymbolStyleLayer predicate option change #12259

JamieJeon opened this issue Jun 29, 2018 · 5 comments
Labels
archived Archived because of inactivity bug iOS Mapbox Maps SDK for iOS

Comments

@JamieJeon
Copy link

Platform: iOS
Mapbox SDK version: 4.1.0

Steps to trigger behavior

  1. I added the MGLSymbolStyleLayer with geojson file and I got the three of features
  2. I added a single tap gesture recognizer to change the predicate of the MGLSymbolStyleLayer
  3. I found a strange thing that is the count of visible features

Expected behavior

  1. I expected that the count of visible features is 2 when the predicate is like this.
    2018-06-29 11 35 22
    poi2

  2. I expected that the count of visible features is 3 when the predicate is nil back.
    2018-06-29 11 37 00
    poi3

Actual behavior

  1. Actual the count of visible features is 3 when the case 1

  2. Actual the count of visible features is 2 when the case 2

The visible features aren't refreshed immediately after changing predicate.
If there is a changed feature after changing predicate then I got the collect list of visible features.
Also If I move the map after changing predicate, I got the collect list.

Is it a bug???

@fabian-guerra
Copy link
Contributor

Hi, @JamieJeon. Thank you for using Mapbox. I am sorry to hear you are having some issues. In order to track the problem could you please share a code snippet or test app?

Also @ChrisLoer flagging this as it seems related to #11780

@fabian-guerra fabian-guerra added bug iOS Mapbox Maps SDK for iOS labels Jun 29, 2018
@ChrisLoer
Copy link
Contributor

The visible features aren't refreshed immediately after changing predicate.
If there is a changed feature after changing predicate then I got the collect list of visible features.
Also If I move the map after changing predicate, I got the collect list.

Hi @JamieJeon, if I'm understanding that correctly, it sounds like expected behavior. The queryRenderedFeatures API does not synchronously reflect changes to symbol state. The reason is that, for symbols (icons and text), queryRenderedFeatures depends on collision detection having been run before it shows results (so for instance, you could add a symbol, but the symbol might not show on screen because of collision detection). Collision detection runs asynchronously (at least every 300ms, sometimes more often), and therefore the results of queryRenderedFeatures are similarly asynchronous.

@JamieJeon
Copy link
Author

@ChrisLoer Thank you for answering this.
Then, what should i do if i want the result synchronous??
Is there the way to refresh the map without moving?

@ChrisLoer
Copy link
Contributor

Hi @JamieJeon, there's no way to force collision detection to happen synchronously.

I think you probably want to design around the assumption that this is asynchronous -- that stays closest to how the underlying map works. But if it is really necessary to be able to get the count synchronously, I think you'd have to implement it yourself. Something like "I just added this symbol, and I know the symbol has icon-allow-overlap: true, and I know the symbol is positioned within the current viewport, so I'm going to increment my 'visible' counter by one". Sorry, I know that's not an easy answer!

@stale stale bot added the archived Archived because of inactivity label Dec 29, 2018
@stale
Copy link

stale bot commented Dec 29, 2018

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Dec 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity bug iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

3 participants