{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/6055","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-native","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/6055/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/6055/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/6055/events","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/6055","id":171710882,"number":6055,"title":"Map::queryPointAnnotations() -> Map::queryRenderedFeatures() returns unexpected result as map is moved","user":{"login":"boundsj","id":63186,"avatar_url":"https://avatars.githubusercontent.com/u/63186?v=3","gravatar_id":"","url":"https://api.github.com/users/boundsj","html_url":"https://github.com/boundsj","followers_url":"https://api.github.com/users/boundsj/followers","following_url":"https://api.github.com/users/boundsj/following{/other_user}","gists_url":"https://api.github.com/users/boundsj/gists{/gist_id}","starred_url":"https://api.github.com/users/boundsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boundsj/subscriptions","organizations_url":"https://api.github.com/users/boundsj/orgs","repos_url":"https://api.github.com/users/boundsj/repos","events_url":"https://api.github.com/users/boundsj/events{/privacy}","received_events_url":"https://api.github.com/users/boundsj/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/Android","name":"Android","color":"000000"},{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/beta%20blocker","name":"beta blocker","color":"0e8a16"},{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/Core%20GL","name":"Core GL","color":"000000"},{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/iOS","name":"iOS","color":"000000"},{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/needs%20discussion","name":"needs discussion","color":"b60205"}],"state":"open","locked":false,"assignee":{"login":"boundsj","id":63186,"avatar_url":"https://avatars.githubusercontent.com/u/63186?v=3","gravatar_id":"","url":"https://api.github.com/users/boundsj","html_url":"https://github.com/boundsj","followers_url":"https://api.github.com/users/boundsj/followers","following_url":"https://api.github.com/users/boundsj/following{/other_user}","gists_url":"https://api.github.com/users/boundsj/gists{/gist_id}","starred_url":"https://api.github.com/users/boundsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boundsj/subscriptions","organizations_url":"https://api.github.com/users/boundsj/orgs","repos_url":"https://api.github.com/users/boundsj/repos","events_url":"https://api.github.com/users/boundsj/events{/privacy}","received_events_url":"https://api.github.com/users/boundsj/received_events","type":"User","site_admin":false},"assignees":[{"login":"boundsj","id":63186,"avatar_url":"https://avatars.githubusercontent.com/u/63186?v=3","gravatar_id":"","url":"https://api.github.com/users/boundsj","html_url":"https://github.com/boundsj","followers_url":"https://api.github.com/users/boundsj/followers","following_url":"https://api.github.com/users/boundsj/following{/other_user}","gists_url":"https://api.github.com/users/boundsj/gists{/gist_id}","starred_url":"https://api.github.com/users/boundsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boundsj/subscriptions","organizations_url":"https://api.github.com/users/boundsj/orgs","repos_url":"https://api.github.com/users/boundsj/repos","events_url":"https://api.github.com/users/boundsj/events{/privacy}","received_events_url":"https://api.github.com/users/boundsj/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/milestones/37","html_url":"https://github.com/mapbox/mapbox-gl-native/milestones/ios-v3.4.0","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/milestones/37/labels","id":1783804,"number":37,"title":"ios-v3.4.0","description":"The release will go through a series of alpha and beta versions until it reaches a stable state and is made generally available. In the alpha phase, we publish a version that have enough new features as to be useful for developers who would like to test and help report issues. In the beta phase, we've locked down new feature development and are focused mostly on stability issues. In general, after the first alpha, we aim to release a new alpha (or beta) version once per week.\r\n\r\n## Releases\r\n\r\n- Alpha 1: 8/11\r\n- Alpha 2: 8/18 (planned)\r\n","creator":{"login":"friedbunny","id":1198851,"avatar_url":"https://avatars.githubusercontent.com/u/1198851?v=3","gravatar_id":"","url":"https://api.github.com/users/friedbunny","html_url":"https://github.com/friedbunny","followers_url":"https://api.github.com/users/friedbunny/followers","following_url":"https://api.github.com/users/friedbunny/following{/other_user}","gists_url":"https://api.github.com/users/friedbunny/gists{/gist_id}","starred_url":"https://api.github.com/users/friedbunny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friedbunny/subscriptions","organizations_url":"https://api.github.com/users/friedbunny/orgs","repos_url":"https://api.github.com/users/friedbunny/repos","events_url":"https://api.github.com/users/friedbunny/events{/privacy}","received_events_url":"https://api.github.com/users/friedbunny/received_events","type":"User","site_admin":false},"open_issues":52,"closed_issues":32,"state":"open","created_at":"2016-05-23T22:50:20Z","updated_at":"2016-08-17T19:44:17Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2016-08-17T17:09:48Z","updated_at":"2016-08-17T20:24:08Z","closed_at":null,"body":"In https://github.com/mapbox/mapbox-gl-native/pull/5165 we added a new method `queryPointAnnotations` that calls `queryRenderedFeatures` with a `ScreenBox` representing the view port for which you want to query for all point annotations. In the iOS SDK, this is used by:\r\n\r\n- -[MGLMapView annotationTagAtPoint:persistingResults:] // used for annotation selection\r\n- -[MGLMapView accessibilityAnnotationCount]\r\n- -[MGLMapView accessibilityElementAtIndex:]\r\n- -[MGLMapView indexOfAccessibilityElement:]\r\n\r\nI was planing to use `queryPointAnnotations` in https://github.com/mapbox/mapbox-gl-native/pull/5987 to help clean up and optimize the implementation in the iOS SDK's `updateAnnotationViews`. However, based on the visual behavior I'm seeing after doing that, I don't know that it'll be possible to rely on the underlying `queryRenderedFeatures` for this purpose.\r\n\r\nFor example, if I give `queryPointAnnotations\\queryRenderedFeatures` a view port of:\r\n\r\n`viewPort == mapView.bounds //(origin = (x = 0, y = 0), size = (width = 375, height = 667))`\r\n\r\nI see that the annotation view update method stops updating views ~almost~ when I would expect it to, at first (the views get stuck near the edge of the view port when their annotations move offscreen). However, when I change the zoom level, the view port / ScreenBox seems to reflect only the upper left section of the view. This is illustrated by native views getting stuck on the map even when the underlying annotation is still technically visible -- at this point, `queryPointAnnotations` is returning less annotations than I would expect (and sometimes 0 annotations). \r\n\r\n![bounds](https://cloud.githubusercontent.com/assets/63186/17745086/6398f53a-645f-11e6-886f-05ede8539fbb.gif)\r\n\r\nAnother issue is that the result of `queryPointAnnotations\\queryRenderedFeatures` seems to lag behind the map movement. This is particularly noticeable when changing zoom level. Annotation views will maintain their `center` for the last zoom level and then snap back suddenly.\r\n\r\n![zoom](https://cloud.githubusercontent.com/assets/63186/17745173/aee74136-645f-11e6-9382-dae033d281e0.gif)\r\n\r\nFinally, I see that `queryPointAnnotations\\queryRenderedFeatures` returns no annotations where I expect it should as the map is panned. However, once panning is stopped you can still select annotations via `[MGLMapView annotationTagAtPoint:persistingResults:]` (which uses `queryPointAnnotations\\queryRenderedFeatures` under the hood) by clicking where they ~should~ be (not where the annotation view is floating) and you get the \"expected\" result (a callout over the actual location of the annotation that really is in the view port):\r\n\r\n<img width=\"377\" alt=\"screen shot 2016-08-17 at 9 31 10 am\" src=\"https://cloud.githubusercontent.com/assets/63186/17745356/5d2855f0-6460-11e6-8bc0-6e41ebe09c74.png\">\r\n\r\nFor now, I don't think we should use `queryPointAnnotations\\queryRenderedFeatures` as currently implemented for queries when the map is panned, zoom levels are changed, rotation or pitch is changed, etc. I'm not able to reproduce this issue under test in `test/api/annotations.cpp` but the test does not simulate queries while the map is moved so it may be fine to keep #5165 for the use cases it was written for (noted above) and just not use it for the `updateAnnotationViews` case.\r\n\r\n### Next steps:\r\n\r\n- [ ] Simplify #5165 to **not** use `queryPointAnnotations`\r\n- [ ] Test that `accessibilityAnnotationCount`, `accessibilityElementAtIndex:`, `indexOfAccessibilityElement:` work as expected when implemented using `queryPointAnnotations`\r\n- [ ] Review the implementation of `queryPointAnnotations` with @jfirebaugh to learn more about how it should / can be used\r\n- [ ] Revert #5165 if necessary (this may not be required if it works for all cases other than annotation view updates)\r\n\r\ncc @1ec5 @tobrun @incanus @jfirebaugh @pveugen \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/comments/240536033","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/6055#issuecomment-240536033","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/6055","id":240536033,"user":{"login":"1ec5","id":1231218,"avatar_url":"https://avatars.githubusercontent.com/u/1231218?v=3","gravatar_id":"","url":"https://api.github.com/users/1ec5","html_url":"https://github.com/1ec5","followers_url":"https://api.github.com/users/1ec5/followers","following_url":"https://api.github.com/users/1ec5/following{/other_user}","gists_url":"https://api.github.com/users/1ec5/gists{/gist_id}","starred_url":"https://api.github.com/users/1ec5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1ec5/subscriptions","organizations_url":"https://api.github.com/users/1ec5/orgs","repos_url":"https://api.github.com/users/1ec5/repos","events_url":"https://api.github.com/users/1ec5/events{/privacy}","received_events_url":"https://api.github.com/users/1ec5/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T20:24:08Z","updated_at":"2016-08-17T20:24:08Z","body":"We should determine whether these issues arise from calling `mbgl::Map::queryRenderedFeatures()` in response to `mbgl::MapChangeDidFinishRenderingFrame`. Perhaps the feature index hasn’t been updated by that point? Otherwise, maybe we have on our hands a real bug in `queryRenderedFeatures()` that would affect ordinary querying. We should investigate both possibilities before abandoning `queryPointAnnotations()`, which would put #5502 in jeopardy."}}
{"actor":{"display_login":"1ec5"}}