Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda