MapLibre GL JS
This example adds the current temperature data as a fill layer to a MapLibre GL map using the Weather API vector tile source.
const API_KEY = "YOUR_API_KEY";
const map = new maplibregl.Map({
container: "map",
style: "https://styles.maptoolkit.net/maptoolkit/maptoolkit.summer.json?api_key=" + API_KEY,
center: [13.0, 47.5],
zoom: 5,
});
map.on("load", () => {
map.addSource("weather", { type: "vector", url: `https://weather.maptoolkit.net/vector/icon.0.json?api_key=${API_KEY}` });
const firstSymbolId = (map.getStyle().layers.find((l) => l.type === "symbol") || {}).id;
map.addLayer({
id: "weather-temperature", type: "fill", source: "weather", "source-layer": "temperature",
paint: {
"fill-color": ["interpolate", ["linear"], ["get", "degree"], -20, "#313695", 0, "#74add1", 10, "#fee090", 20, "#f46d43", 35, "#a50026"],
"fill-opacity": 0.6,
},
}, firstSymbolId);
});<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/maplibre-gl.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/maplibre-gl.css" />
<style>
html, body { width: 100%; height: 100%; margin: 0; padding: 0; }
#map { width: 100%; height: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
const API_KEY = "YOUR_API_KEY";
const map = new maplibregl.Map({
container: "map",
style: "https://styles.maptoolkit.net/maptoolkit/maptoolkit.summer.json?api_key=" + API_KEY,
center: [13.0, 47.5],
zoom: 5,
});
map.on("load", () => {
map.addSource("weather", { type: "vector", url: `https://weather.maptoolkit.net/vector/icon.0.json?api_key=${API_KEY}` });
const firstSymbolId = (map.getStyle().layers.find((l) => l.type === "symbol") || {}).id;
map.addLayer({
id: "weather-temperature", type: "fill", source: "weather", "source-layer": "temperature",
paint: {
"fill-color": ["interpolate", ["linear"], ["get", "degree"], -20, "#313695", 0, "#74add1", 10, "#fee090", 20, "#f46d43", 35, "#a50026"],
"fill-opacity": 0.6,
},
}, firstSymbolId);
});
</script>
</body>
</html>Use the prompt below with any LLM to get the same result. Make sure the Maptoolkit MCP server is connected first — check out AI Integration & MCP to get started.
Use the Maptoolkit Connector. Create a map centered on Austria with MapLibre GL and put a heat map of the current temperature of Europe on top.