Skip to content

Intensity doesn't affect gradient  #131

@FrankieDuck

Description

@FrankieDuck

Hello,

I have been working with this package and from my understanding the intensity doesn't affect the gradient? What does seem to affect the gradient is how close a point is to other points, that also changes depending on zoom level. So a cluster of points will have a higher intense gradient.

Is there anyway to directly use the intensity value to control the gradient that is passed to the heat layer? I want to represent points with higher values as a darker colour as opposed to lower values with a lighter gradient. With the current functionality a point with an intensity value of 0.77 would have the same colour as one with 0.22.

So, instead of a heatmap based on coordinates proximity to each other, I want it to be affected by the strength value of each coordinate.

thank you any help!

an example of my array would be like this:
[60300, 86220, 0.67],
[64122, 85670, 0.23]

~code below

const HeatmapComponent = ({ heatMapData }) => {
  const map = useMap()

  useEffect(() => {
    const points = heatMapData ?.map((data) => {
      const lat = data[0][0]
      const lng = data[0][1]
      const str = data[0][2]

      return [lat, lng, str]
    })

    const heatLayer = L.heatLayer(points, {
      minOpacity: 0.5,
      maxZoom: map.getMaxZoom(),
      max: 1.0,
      radius: 15,
      blur: 15,
    }).addTo(map)

    return () => {
      map.removeLayer(heatLayer)
    }
  }, [heatmapCords, map])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions