Atlaslog / Field Notes / MapLibre styles & layers
Field note · MapLibre styles & layers
addLayer succeeds but nothing appears on the map
Quick answer
getLayer returns the layer object and no error is raised, yet no geometry renders because the filter, minzoom, visibility or layer order excludes it. A missing source name instead surfaces as Source not found.
Symptom
- map.getLayer('poi') exists but the circle layer draws nothing at the current zoom.
- Error: Source "poi" not found at Style.addLayer (style.ts:1204).
- querySourceFeatures('poi') returns the expected count while queryRenderedFeatures finds nothing.
Checklist
- Print map.getSource('poi'), getLayer('poi'), getLayoutProperty visibility and getFilter.
- Call querySourceFeatures to separate no data from no style.
- Set the filter to null and see whether features appear.
- Check minzoom against map.getZoom() and whether an opaque fill layer covers the layer.
Fix
Add the source and layer inside load with layout: { visibility: 'visible' }, place it above the fill layers with map.moveLayer('poi-circle'), and loosen the filter before tightening it.
Code
Error: Source "poi" not found
at Style.addLayer (style.ts:1204)console.log('source', map.getSource('poi'));
console.log('layer', map.getLayer('poi'));
console.log('visibility', map.getLayoutProperty('poi', 'visibility'));
console.log('filter', map.getFilter('poi'));
console.log('zoom', map.getZoom());
console.log('source features', map.querySourceFeatures('poi').length);
Watch out
- Setting minzoom to 14 while the map opens at zoom 11 makes the layer look broken rather than hidden.
- Passing a single Feature instead of a FeatureCollection to the geojson source produces an empty source.
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Atlaslog (2026). addLayer succeeds but nothing appears on the map. https://www.jingweizhi.com/en/cookbook/maplibre-layer-not-show.html (accessed 2026-11-03).