mapbox / mapbox/mapbox-maps-android

Getting GeoJson cluster leaves sometimes results in "No FeatureExtension `supercluster`" errors

Open
#2,404 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Android OS version: 10
- Devices affected: Motorola moto g7 power
- Maps SDK Version: 11.3.1

## Observed behavior and steps to reproduce

I'm unable to get the features corresponding to a point cluster. I have the following code that shows details about the features in a cluster when it's clicked:

```kotlin
private val handlePointClusterClick = OnMapClickListener { point ->
lifecycleScope.launch {
val featuresOrError = mapboxMap.queryRenderedFeatures(
RenderedQueryGeometry(mapboxMap.pixelForCoordinate(point)),
RenderedQueryOptions(listOf(clusterTextLayerId), null)
)

if (featuresOrError.isError) {
Log.e(TAG, "error querying for cluster ${featuresOrError.error}")
} else {
featuresOrError.value?.firstOrNull()?.let { cluster ->
val leavesOrError = mapboxMap.getGeoJsonClusterLeaves(
cluster.queriedFeature.source,
cluster.queriedFeature.feature,
Long.MAX_VALUE,
0
)

if (leavesOrError.isError) {
Log.e(TAG, "error querying for leaves ${leavesOrError.error}")
} else {
leavesOrError.value?.featureCollection?.let { features ->
// display features here...
}
}
}
}
}

true
}
```

For most of the clusters on my map, this code works fine. However, for some the call to `getGeoJsonClusterLeaves` results in the following error in the logs:

```
[maps-core]: {}[General]: No FeatureExtension `supercluster` found for `mapbox-android-pointAnnotation-source-1` source.
error querying for leaves No FeatureExtension found for source mapbox-android-pointAnnotation-source-1
```

## Expected behavior

I expect `getGeoJsonClusterLeaves` to return a value, not an error, containing all of the features in the cluster.

## Notes / preliminary analysis

I attempted to write my own function to get the leaves by recursively calling `getGeoJsonClusterChildren`. In doing so, most of the calls to `getGeoJsonClusterChildren` succeeded, and I was able to get most of the leaves, but a few of the calls returned this same `No FeatureExtension...` error. As far as I can tell, there seems to be something wrong with a few of the sub-clusters that causes this behavior.

## Additional links and references

None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Kotlin snippet around queryRenderedFeatures and getGeoJsonClusterLeaves, then compare the failing clusters with successful ones. Inspect the related getGeoJsonClusterChildren calls and the mapbox-android-pointAnnotation-source-1 source. Done means cluster leaves can be retrieved without the “No FeatureExtension `supercluster`” error and include all features.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.