0

Adapting the documented example here

To produce the code below I get the following error.

Error: "layers.circles-heat.paint.circle-color.stops[9][1]: color expected, "#5675d2" found"

      map.addLayer({
        'id': 'circles-heat',
        'type': 'circle',
        'source': 'circle_source_layer',
        "minzoom": 2,
        "maxzoom": 22,
        'layout': {
          'visibility': 'visible'
        },
        "source-layer": "heat_supply_20120411",
        "paint": {
          // make circles larger as the user zooms from z12 to z22
          'circle-radius': {
            'base': 1.75,
            'stops': [
              [12, 2],
              [22, 180]
            ]
          },
          "circle-color": {
            "property": "typology", 
            'type': 'categorical',
            "default": "#9a9a9a", 
            'stops': [
              ['CHP Site', "#8bc85f"],
              ['CHP sites', "#8bc85f"],
              ['CHP Sites', "#8bc85f"],
              ['Energy from waste plants', "#31c4ec"],
              ['EUETS sites', "#e90e1d"],
              ['NHS', "#b80fd6"],
              ['Other low-zero carbon plants', "#ef5eb8"],
              ['Power Plant', "#d99d65"],
              ['Power plants', "#d99d65"],
              ['Significant Supply Plant', "#5675d2"]
            ]
        }
      }
      });

I've also tried the adapting another documented example as below but get this error instead;

Error: "layers.circles-heat.paint.circle-color[2]: Could not parse color from value '#8bc85f'"

            'circle-color': [
            'match',
            ["get", "typology"],
            'CHP Site', '#8bc85f',
            'CHP sites', '#8bc85f',
            'CHP Sites', '#8bc85f',
            'Energy from waste plants', '#31c4ec',
            'EUETS sites', '#e90e1d',
            'NHS', '#b80fd6',
            'Other low-zero carbon plants', '#ef5eb8',
            'Power Plant', '#d99d65',
            'Power plants', '#d99d65',
            'Significant Supply Plant', '#5675d2',
            /* other */
            '#ccc',
          ]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.