Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

230
Views
Heatmap leaflet can't output gradient color

I have an example of a simple flyer heatmap with data from the API. But it doesn't generate a gradient heatmap as it should.

enter image description here

have to think of the gradient indexes (0.0 to 1.0) as a cursor from 0% to 100% of your max intensity

const body = {
                f: "json",
                returnGeometry: true,
                rollbackOnFailure: true,
                geometry: JSON.stringify({
                    xmin: bounds.west,
                    ymin: bounds.south,
                    xmax: bounds.east,
                    ymax: bounds.north,
                    spatialReference: { wkid: 4326 },
                }),
                geometryType: "esriGeometryEnvelope",
            };

And GeoJSOn:

<GeoJSON
                    ref={geoJsonLayer}
                    data={props.data}
                    onEachFeature={onEachState}
                    pointToLayer={heatmapToLayerState}
                />

That pointToLayer={heatmapToLayerState} part of the data:

import L from "leaflet";

const CustomMarker = (latlng) => {
  const iconMarker = new L.Icon({
    gradient: {
      0.2: '#ffffb2',
      0.4: '#fd8d3c',
      0.6: '#fd8d3c',
      0.8: '#f03b20',
      1: '#bd0026'
    }
  });

  return L.marker(latlng, {
    icon: iconMarker,
  });
};

export const heatmapToLayerState = (_, latlng) => {
  return CustomMarker(latlng);
};

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!