Skip to content

[Bug]: queryRenderedFeaturesAtPoint returns wrong features on Android #4092

@whiteHatCip

Description

@whiteHatCip

Mapbox Implementation

Mapbox

Mapbox Version

11.5.2

React Native Version

0.82.1

React Native Architecture

New Architecture (Fabric/TurboModules)

Platform

Android

@rnmapbox/maps version

10.2.7

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}}>
        <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    );
  }
}

Observed behavior and steps to reproduce

Run the application on Android.

Tapping any point on the map and querying the rendered features at the tapped point does not return the expected properties. For instance, tappin on any POI on the map returns either nothing or the non-corresponding feature that was actually tapped.

Expected behavior

Tapping any point on the map should instead return all the features in that location

Notes / preliminary analysis

queryRenderedFeaturesAtPoint uses tap coordinates in DIP (because getPointInView divides by density) but MapboxCore interprets it as pixels. Result: The query is moved/climbed and returns different/wrong features than the ones returned from iOS.

Additional links and references

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🪲Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions