MA

maplibre-tile-sources

Guide to selecting and setting up map data sources for MapLibre.

Install

mkdir -p .claude/skills/maplibre-tile-sources && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12624" && unzip -o skill.zip -d .claude/skills/maplibre-tile-sources && rm skill.zip

Installs to .claude/skills/maplibre-tile-sources

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

How to choose and configure data sources for MapLibre GL JS — rendering your own data without tiles, hosted tile services, serverless PMTiles, self-hosted tile servers, tile schemas, glyphs, and sprites.
203 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Choose appropriate MapLibre GL JS data sources
  • Configure styles, glyphs, and sprites for maps
  • Render GeoJSON data directly without a tile server
  • Select between offset-based and cursor-based pagination
  • Debug blank maps or missing tiles
  • Migrate from Mapbox tile sources

How it works

The skill guides the selection and configuration of MapLibre GL JS data sources, including GeoJSON, vector tiles, and raster tiles, based on geographic scale, update frequency, and performance considerations.

Inputs & outputs

You give it
Map data requirements and desired map functionality
You get back
Configured MapLibre GL JS map with appropriate data sources and styles

When to use maplibre-tile-sources

  • Configuring map sources
  • Setting up map styles
  • Debugging tile loading issues

About this skill

MapLibre Tile Sources

MapLibre GL JS does not ship with map data. You provide a style that references sources — URLs or inline data that MapLibre fetches and renders. MapLibre works equally well for a store locator with 200 addresses, a city transit map, and a global basemap — the right source type depends on geographic scale and level of detail, update frequency, infrastructure constraints, and use case.

When to Use This Skill

  • Setting up a new MapLibre map and choosing where your data comes from
  • Deciding between GeoJSON, serverless tiles, hosted services, a combination thereof, or self-hosted options
  • Configuring glyphs (fonts) and sprites so labels and icons render
  • Debugging blank maps or missing tiles
  • Migrating from Mapbox and need equivalent tile sources and style setup

How styles and sources work

A style (a style JSON, style document, or style object) is the configuration you pass to MapLibre. It contains the specific rendering rules governed by the MapLibre Style Specification, maintained with parity for MapLibre GL JS and MapLibre Native.

You can use a style URL from a provider — that URL references a style with sources, layers, glyphs, and sprite. Or you can build your own style and configure each yourself.

A style has three main components:

  • Sources — Point to the actual data. Each source has a type and either inline data or a URL. MapLibre requests tiles or data as the viewport changes. The same source can back many layers (e.g. roads, water, and labels all from one vector URL).
  • Layers — An ordered list defining what to draw and how. Each layer references a source (and for vector tiles, a source-layer name) and specifies paint/layout properties.
  • Glyphs and sprite — Required for text and icons: URLs to font SDF stacks and icon spritesheets. Without them, labels and symbols won't appear.

Source types:

TypeDescription
vectorVector tiles — binary-encoded geometry and attributes; the primary format for basemaps and data overlays
rasterRaster tile imagery — satellite photos, WMS/WMTS layers
raster-demElevation tiles — for terrain rendering and hillshading
geojsonGeoJSON data — inline object or URL; no tile server needed
imageA single georeferenced image — scanned maps, annotated overlays
videoGeoreferenced video

vector and raster are the most common for basemaps and data overlays. geojson is ideal for small datasets or interactive data that doesn't need tiling. raster-dem is used for terrain and hillshade effects, as well as emerging use cases in scientific visualization. image and video sources are the least common, but let you georeference static images (such as a scanned map, chart, or overlay) or georeferenced videos as map layers.

GeoJSON and Direct Data Sources

For many use cases you don't need a tile service. MapLibre can render points, lines, or polygons directly from an inline GeoJSON object or a URL to a GeoJSON file. The entire dataset is downloaded and parsed in the browser; MapLibre handles rendering client-side.

map.addSource('my-data', {
  type: 'geojson',
  data: '/path/to/data.geojson' // or an inline GeoJSON object
});
map.addLayer({
  id: 'my-layer',
  type: 'fill',
  source: 'my-data',
  paint: { 'fill-color': '#0080ff', 'fill-opacity': 0.5 }
});

GeoJSON performance thresholds

GeoJSON downloads the entire file on every load. This works well at small scale and degrades predictably:

RangeFile size / feature countBehavior
Sweet spot< 2 MB / < 5,000 featuresInstantaneous loading, smooth interaction
Lag zone5–20 MB / up to ~50,000 features1–3s parse delay; mobile may struggle; optimize by simplifying geometries and reducing coordinate precision
Crash zone> 50 MB / > 100,000 featuresHigh risk of browser freeze or crash; switch to vector tiles

GeoJSON is lossless (exact coordinates preserved) and gives you full client-side access to feature properties — ideal for interactive data, dynamic updates, and datasets where you need to query or modify features without a server round-trip.

If your dataset exceeds these thresholds, or if you need zoom-dependent rendering (less detail at lower zoom levels), consider vector tiles instead.

Other formats and the cloud-native ecosystem

The choice of data source is shaped by more than performance: data type, update frequency, access patterns, and the broader geospatial ecosystem all factor in. Many formats (FlatGeobuf, GeoParquet, Cloud-Optimized GeoTIFF, KML, GPX, and more) can be displayed in MapLibre via plugins and custom protocols. The cloud-native geospatial ecosystem — formats designed for HTTP range requests and distributed storage — is evolving rapidly and increasingly relevant for web maps. A separate skill will cover this in depth; for now, see the Map Rendering Plugins and Utility Libraries sections of awesome-maplibre.

When You Need Tiles

Vector tiles load only the data visible in the current viewport, in a compact binary format. Use them when:

  • Your dataset exceeds GeoJSON's practical limits
  • You need zoom-dependent rendering (different levels of detail at different zoom levels)
  • You need global or regional reference layers, such as land and water, roads, place names, etc. (i.e., basemap data)
  • Bandwidth efficiency matters at scale

Vector tiles vs. raster tiles

When you need tiles, you'll choose between two tile types:

Vector tiles encode geometry and feature attributes as compact binary data (Mapbox Vector Tile format, or the newer MapLibre Tile / MLT). MapLibre renders and styles them client-side:

  • Styles can be changed without regenerating tiles
  • Features are queryable (click, hover interactions)
  • Text renders crisply at any zoom or screen density
  • Significantly smaller file sizes than equivalent raster tiles

Raster tiles are pre-rendered images (PNG, JPEG, or WebP) at each zoom level, displayed by MapLibre as-is:

  • No client-side styling or feature querying
  • Larger file sizes, but simpler to generate and serve
  • Good fit for satellite/aerial imagery, WMS/WMTS integration, or rendered styles that don't need client-side customization

Most MapLibre workflows use vector tiles; increasing numbers are integrating raster-dem sources e.g. for terrain rendering. Use raster tiles when you need satellite/aerial imagery, when integrating with existing WMS or WMTS services, or when you need a pre-rendered cartographic style.

Using MapLibre with Leaflet

Leaflet is a widely used JavaScript mapping library that supports only raster tiles. If your app is built on Leaflet, MapLibre GL Leaflet lets you pre-render a MapLibre GL compatible style as a raster layer — allowing you to use hosted vector tile sources in your Leaflet app.

Combining source types

A MapLibre style can have any number of sources of any types simultaneously. Layers from different sources are composited in draw order. This makes it natural to mix sources for different purposes.

Sources can be composited in a custom style sheet or at run-time. Be aware that layer order matters: layers are drawn bottom-to-top in the order they appear in the style. A raster layer added after vector layers will obscure them.

  • Vector basemap + GeoJSON overlay — the most common pattern. Use a provider's style URL (or any vector tile source) as your basemap and add your own data on top with map.addSource() and map.addLayer(). To keep labels readable, insert your layer before the first symbol layer rather than appending to the top of the stack.
// Start with any basemap style URL, then add your own data below labels
map.on('load', () => {
  // Find the first symbol (label) layer to insert below
  const firstSymbolId = map.getStyle().layers.find((l) => l.type === 'symbol')?.id;

  map.addSource('my-data', { type: 'geojson', data: '/path/to/data.geojson' });
  map.addLayer(
    { id: 'my-layer', type: 'circle', source: 'my-data' },
    firstSymbolId // insert before labels; omit to append above everything
  );
});
  • Raster imagery + vector labels — add a raster source for satellite imagery, weather radar, historical imagery, heatmaps rendered server-side, or any imagery that isn't available as vector data. Add a vector source for roads, place names and other labels. This gives crisp imagery with crisp, resolution-independent vector geometries and labels on top.
  • Vector basemap + raster-dem terrain — add hillshading or 3D terrain to any vector basemap using a raster-dem source (elevation tiles). This is how MapLibre renders terrain and hillshade without a separate basemap style.

When to choose each approach


Content truncated.

When not to use it

  • When using a mapping library other than MapLibre GL JS
  • When the primary goal is to generate map tiles, not consume them
  • When working with very large GeoJSON datasets that exceed performance thresholds

Limitations

  • Focuses on MapLibre GL JS and its supported source types
  • GeoJSON performance degrades significantly with large datasets (>50 MB)
  • Requires CORS configuration for self-hosted servers or static storage

How it compares

This skill provides a structured approach to selecting and configuring MapLibre data sources, optimizing for performance and use case, unlike ad-hoc source integration that might lead to performance issues.

Compared to similar skills

maplibre-tile-sources side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
maplibre-tile-sources (this skill)04moNo flagsIntermediate
streamlit869moNo flagsIntermediate
d3-visualization73moNo flagsAdvanced
threejs356moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

streamlit

sverzijl

When working with Streamlit web apps, data dashboards, ML/AI app UIs, interactive Python visualizations, or building data science applications with Python

86239

d3-visualization

lyndonkl

Use when creating custom, interactive data visualizations with D3.js—building bar/line/scatter charts from scratch, creating network diagrams or geographic maps, binding changing data to visual elements, adding zoom/pan/brush interactions, animating chart transitions, or when chart libraries (Highcharts, Chart.js) don't support your specific visualization design and you need low-level control over data-driven DOM manipulation, scales, shapes, and layouts.

7107

threejs

mrgoonie

Build 3D web apps with Three.js (WebGL/WebGPU). Use for 3D scenes, animations, custom shaders, PBR materials, VR/XR experiences, games, data visualizations, product configurators.

3554

streaming-mindmap-rendering

SSShooter

Implement real-time streaming mindmap rendering using Mind Elixir in web applications. Supports streaming text parsing and incremental updates.

525

d3js-visualization

benchflow-ai

Build deterministic, verifiable data visualizations with D3.js (v6). Generate standalone HTML/SVG (and optional PNG) from local data files without external network dependencies. Use when tasks require charts, plots, axes/scales, legends, tooltips, or data-driven SVG output.

722

dashboard-build

mckinsey

A skill that should be invoked whenever a user wants to build a Dashboard or simple app. This skill is Phase 2 of an e2e process that covers the actual build and testing. For Phase 1 (requirements, layout design, visualization selection), use the dashboard-design skill.

619

Search skills

Search the agent skills registry