Getting Started with MapMetrics
What is MapMetrics?
MapMetrics is a next-generation mapping platform that leverages data contributed by users from all around the world. By gathering real-time information from the community, MapMetrics creates highly accurate, up-to-date, and dynamic maps — built by the community, for the community.
MapAtlas is the core technical foundation and mapping engine. MapMetrics is the community-powered layer where users contribute, validate, and benefit from the most up-to-date maps.
Why Choose MapMetrics?
- Community-Driven — Maps constantly updated with data from users worldwide
- Customizable — Style maps to match your brand using the intuitive Studio interface
- Real-Time Updates — Latest map changes, traffic conditions, and points of interest
- Powerful APIs — Map rendering, search, geocoding, directions, and more
- Vector Tile Technology — Efficient, fully customizable client-side rendering
Step 1 — Create Your Style & API Key
- Visit portal.mapmetrics.org
- Go to Styles → create or customize a map style → save → copy the Style URL
- Go to Keys → click New Key → configure permissions → copy your API Key
Your Style URL looks like:
https://gateway.mapmetrics-atlas.net/styles/?fileName=YOUR_ID/style.json&token=YOUR_TOKENThe Style URL already contains your token — use it directly as the
styleoption in the map.
Step 2 — Add MapMetrics to Your Project
Option A: CDN (Plain HTML — quickest)
Add these two lines to your <head>:
html
<link href="https://cdn.mapmetrics-atlas.net/versions/latest/mapmetrics-gl.css" rel="stylesheet" />
<script src="https://cdn.mapmetrics-atlas.net/versions/latest/mapmetrics-gl.js"></script>Then initialize the map:
html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link href="https://cdn.mapmetrics-atlas.net/versions/latest/mapmetrics-gl.css" rel="stylesheet" />
<script src="https://cdn.mapmetrics-atlas.net/versions/latest/mapmetrics-gl.js"></script>
<style>
body { margin: 0; }
#map { height: 100vh; width: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
const map = new mapmetricsgl.Map({
container: 'map',
style: 'YOUR_STYLE_URL_WITH_TOKEN',
center: [0, 20],
zoom: 2
});
map.addControl(new mapmetricsgl.NavigationControl(), 'top-right');
</script>
</body>
</html>⚠️ Important: The global variable is
mapmetricsgl— NOTmaplibregl.
Option B: NPM / React
bash
npm install @mapmetrics/mapmetrics-gljsx
import mapmetricsgl from '@mapmetrics/mapmetrics-gl';
import '@mapmetrics/mapmetrics-gl/dist/mapmetrics-gl.css';
const map = new mapmetricsgl.Map({
container: 'map',
style: 'YOUR_STYLE_URL_WITH_TOKEN',
center: [0, 20],
zoom: 2
});CDN Reference
| File | URL |
|---|---|
| JavaScript | https://cdn.mapmetrics-atlas.net/versions/latest/mapmetrics-gl.js |
| CSS | https://cdn.mapmetrics-atlas.net/versions/latest/mapmetrics-gl.css |
| NPM Package | @mapmetrics/mapmetrics-gl |
| Global variable | mapmetricsgl |
Common Errors
| Error | Cause | Fix |
|---|---|---|
mapmetricsgl is not defined | Using maplibregl or script loaded dynamically without onload | Use mapmetricsgl and put script in <head> |
401 Unauthorized | Invalid or missing token | Get a valid Style URL from portal.mapmetrics.org |
| Blank map | Wrong style URL format | Style URL must include ?token=YOUR_TOKEN |
Next Steps
- Key Creation — detailed API key setup
- Style Creation — customize your map style
- Simple Map CDN example — full working HTML example
- Simple Map NPM example — React/NPM setup
- All Examples — browse all code examples