visgl / visgl/react-map-gl

[Feat] Custom map.querySourceFeatues Renderer

Open
#2,348 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
8.5k
Forks
1.4k
Avg merge
5d 17h
Merged PRs (30d)
3

Description

Target Use Case

This feature is allows you to render content received via the querySourceFeatues function without worrying about React's lifecycle.

Example

Display HTML clusters with custom properties

Proposal

The QuerySourceFeatures (temporary name) component receives the arguments of the querySourceFeatures function, and additionally the target component that should be rendered via render.

Internally, the component references events for data, move, and moveend, and renders through the passed in render if any data has changed.

Here's example code to use

<QuerySourceFeatures
  source="earthquakes"
  filter={["==", "cluster", true]}
  render={({ data }) => {
    <Marker
      longitude={data.geometry.coordinates[0]}
      latitude={data.geometry.coordinates[1]}
    >
      <DonutChart properties={data.properties!} />
    </Marker>
  }}
/>

I've written POC code in the following repo.

If you think it's a good idea to add these features, please review them for further improvements and I'll write a PR.

Otherwise I'll PR that POC code as an example.

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 reviewing the linked POC repository and the cluster HTML examples to understand the proposed QuerySourceFeatures API. Compare its behavior with this proposal, including data, move, and moveend updates, and confirm that rendered querySourceFeatures content can follow React's lifecycle without manual handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.