visgl / visgl/deck.gl

Heatmap: Max radiusPixels or expression in other units

Open
#6,248 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
14.6k
Forks
2.3k
Avg merge
2d 9h
Merged PRs (30d)
42

Description

Target Use case

I am currently in a situation, where I want to control the radiusPixels to be as accurate as possible to a meter value in real-world terms.

Currently the maximum pixel value is 100 as seen here:

https://github.com/visgl/deck.gl/blob/60e9334b3e4705b30b650cfb5445fb2d88851b6e/modules/aggregation-layers/src/heatmap-layer/heatmap-layer.js#L62

Before seeing this limitation, my idea was to increase/decrease the radiusPixels based on zoom level:

const getMetersPerPixel = (latitude: number, zoomLevel: number) => {
  const earthCircumference = 40075017;
  const latitudeRadians = latitude * (Math.PI / 180);
  return (
    (earthCircumference * Math.cos(latitudeRadians)) /
    Math.pow(2, zoomLevel + 9)
  );
};

const getMetersInPixelValue = (
  latitude: number,
  meters: number,
  zoomLevel: number
) => {
  return meters / getMetersPerPixel(latitude, zoomLevel);
};
Proposed feature

Being able to control the value as either meter, kilometer or pixel where pixel would be the default value, where the heat-map would automatically adjust for zoom. Alternatively, it could stay as pixels but being able to handle values above 100.

To Do List
  • Add label and assign to milestone
  • Coding
  • Doc update
  • What’s new update
  • Test

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 with modules/aggregation-layers/src/heatmap-layer/heatmap-layer.js at the radiusPixels limit cited in the issue. First resolve whether the scope is unit-aware radius values or pixel values above 100; done should include the agreed behavior, implementation, documentation, and tests listed in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
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.