Atlaslog
Atlaslog / Field Notes / OpenLayers layers
Field note · OpenLayers layers

renderer: 'webgl' on ol.layer.Vector blanks the layer

Quick answer

ol.layer.Vector accepts a renderer class or the string 'canvas', not 'webgl', so OpenLayers treats the string as a renderer object and fails when it calls getFeatures. WebGL point rendering lives in a separate layer type.

Last verified 2026-11-03 · Multiple versions · Cite this page
Applies to: OpenLayers
Symptom
Checklist
  1. Delete the renderer option and confirm the default canvas path renders.
  2. Identify the layer class: ol.layer.Vector, ol.layer.WebGLPoints or ol.layer.VectorTile.
  3. Check the type of the renderer value being passed.
  4. Read the stack trace for renderDeclutter to confirm an interface mismatch.
Fix

Use new ol.layer.WebGLPoints({ source, style: expressionStyle }) with declarative keys such as 'circle-radius' and 'circle-fill-color', or keep ol.layer.Vector with ol.style.Style for per-feature styling and declutter.

Code
Uncaught TypeError: renderer.getFeatures is not a function
    at VectorLayer.renderDeclutter (VectorLayer.js:412)
var style = {
  'circle-radius': [
    'interpolate', ['linear'], ['get', 'value'],
    0, 3,
    100, 12
  ],
  'circle-fill-color': [
    'case',
    ['>', ['get', 'value'], 80], '#e03131',
    '#1c7ed6'
  ],
  'circle-stroke-width': 1,
  'circle-stroke-color': '#ffffff'
};

var layer = new ol.layer.WebGLPoints({
  source: new ol.source.Vector({ features: features }),
  style: style
});

map.addLayer(layer);
Watch out
All 120 field notesChinese originalRunnable examples
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Cite this page

Atlaslog (2026). renderer: 'webgl' on ol.layer.Vector blanks the layer. https://www.jingweizhi.com/en/cookbook/ol-renderer-wrong.html (accessed 2026-11-03).