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

queryPointAnnottions don't return recently added PointAnnotations #7074

Closed

Description

@tobrun

When looking into #7072, I noticed that a recently added point annotation isn't returned as a result of queryPointAnnotations.

What I do is add a point annotation to the map and almost immediately execute a query with:

nativeMapView.queryPointAnnotations(rect)

This currently results in returning 0 annotations,
if I delay this action this results in returning 1 annotation.

cc @brunoabinader

Activity

  1. added
    Core
    on Nov 15, 2016
  2. jfirebaugh commented on Nov 15, 2016

    @jfirebaugh
    Contributor

    Pretty sure this is expected behavior. queryPointAnnotations relies on queryRenderedFeatures, and a point annotation isn't rendered until it has a chance to pass through the worker layout step, which is an asynchronous operation.

  3. tobrun commented on Nov 16, 2016

    @tobrun
    MemberAuthor

    Thank you for the explanation, makes sense that the marker will not show up until they are actually rendered. I'm converting this issue to an android-docs issue.

  4. added
    Android
    and removed
    Core
    on Nov 16, 2016
  5. added this to the android-v5.0.0 milestone on Nov 16, 2016
  6. self-assigned this
    on Nov 30, 2016
  7. tobrun commented on Nov 30, 2016

    @tobrun
    MemberAuthor

    Changing this to the 4.2.0 milestone since this behavior affects our examples and code we have been using so far in relation to MarkerView.

    We used to be able to:

    MarkerView markerView = mapboxMap.addMarker(markerViewOptions);
    View view = markerViewManager.getView(markerView);

    And the returned View wouldn't be null if the MarkerView was found in the current Viewport. With above described behavior the user needs to wait since adding one is a asynchronous operation. To make this easier for integrating I'm providing an additional addMarker method with a callback interface that is invoked when getView() wouldn't return null anymore. This would end up in using an API as:

    createCarMarker(getLatLngInBounds(), R.drawable.ic_car_top, new MarkerViewManager.OnMarkerViewAddedListener(){
          @Override
          public void onViewAdded(@NonNull MarkerView markerView) {
              randomlyMoveMarker(markerView);
          }
    });

    Besides above we need tests for regressions and an update to documentation around the asynchronous behavior of adding markers for the 4.2.0-release.

  8. tobrun commented on Dec 6, 2016

    @tobrun
    MemberAuthor

    Related PR for this has landed on release branch, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Android

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions