You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
visibleFeatures not returning annotation for current zoom level #14192
The list of annotation at this point is not updated with the new map bound,but instead with the previous map bound. This is especially a problem when zooming in from zoom level where those annotations are not shows to a zoom level where they are shown. At this point the map show the annotation but the visibleFeatures call comes back empty
Steps to reproduce
add a MGLVectorTileSource to a map
call mapView.visibleFeatures in ViewDidChange delegate callback
launch the app and zoom in until you reach a zoom level where the annotations are shown
Expected behavior
mapView.visibleFeatures returns an array containing the visible annotations
As I move the map around I get the notification that the map is done loading
@otusweb can you try moving your logic to either of these delegate methods:
func mapViewDidFinishRenderingFrame(_ mapView: MGLMapView, fullyRendered: Bool) where fullyRendered == true
func mapViewDidBecomeIdle(_ mapView: MGLMapView)
visibleFeatures requires rendering to have occurred, and it's sounds like you're calling it too early in the cycle. See this related comment for some additional background: #14531 (comment)
Activity
victorlsn commentedon Jul 2, 2019
I'm also having that problem. Did you find any solution?
otusweb commentedon Jul 2, 2019
@victorlsn no
julianrex commentedon Jul 2, 2019
@otusweb can you try moving your logic to either of these delegate methods:
func mapViewDidFinishRenderingFrame(_ mapView: MGLMapView, fullyRendered: Bool)wherefullyRendered == truefunc mapViewDidBecomeIdle(_ mapView: MGLMapView)visibleFeaturesrequires rendering to have occurred, and it's sounds like you're calling it too early in the cycle. See this related comment for some additional background: #14531 (comment)victorlsn commentedon Jul 2, 2019
@julianrex that actually solved that issue on my side.
Thank you very much.
julianrex commentedon Jul 2, 2019
Excellent to hear @victorlsn!
chloekraw commentedon Jul 6, 2019
Thanks @julianrex! Closing this issue as it looks like there's no bug.