Skip to content
Other Libraries

Other Libraries

Maptoolkit’s tile APIs and services are compatible with the most widely-used open-source and commercial mapping libraries. Use this page to find the right library for your project - each one has a dedicated page with setup instructions and code examples.

Leaflet vs MapLibre GL JS

Both libraries draw Maptoolkit maps and call the same Maptoolkit APIs, so the choice is about the map itself: raster images or vector data, 2D or 3D, a small script or a GPU renderer. In short:

  • MapLibre GL JS if you want a vector map with 3D terrain, runtime styling and the Maptoolkit controls from Our MapLibre Plugins. We recommend it for most projects.
  • Leaflet if you want a small, simple 2D map on raster tiles that runs without WebGL.

Side by side

MapLibre GL JSLeaflet
RenderingVector tiles, WebGLRaster tiles, DOM and canvas
Maptoolkit basemapVector stylesRaster styles; vector through a bridge plugin
Needs WebGLYesNo
3D terrain, pitch and rotationYes, with a built-in terrain controlNo
Change the style in the browserYes, per layerNo, the tiles are images
Labels below your dataYesNo on raster tiles, which include the labels
ZoomFractional, smoothWhole steps by default
Coordinate order[lng, lat][lat, lng]
Maptoolkit controlsStyle, isochrone, logo and legend as pluginsBuild your own
API keyIn the style URLIn the tile URL
Script size, gzippedabout 250 kBabout 42 kB
LicenseBSD-3-ClauseBSD-2-Clause

Sizes are the CDN builds of MapLibre GL JS 5.6.1 and Leaflet 1.9.4.

When to choose MapLibre GL JS

MapLibre GL JS renders the Maptoolkit vector styles from a style URL. 3D terrain and the globe view are built in, and the Maptoolkit style switcher, isochrone control, logo and legend are available as MapLibre plugins. The MapLibre API, style expressions and the wider MapLibre plugin ecosystem all work with Maptoolkit tiles.

Choose it for new projects on Maptoolkit, and when you want 3D terrain, runtime styling or thousands of features drawn on the GPU. The framework guides show it in React, Vue, Angular and Next.js. See the MapLibre examples.

When to choose Leaflet

Leaflet draws the map from raster tiles, square images that already contain roads and labels. That makes it small, quick to learn and independent of WebGL, so it runs on old devices and locked-down browsers where a vector map stays blank. Markers, popups and lines are objects on the map, and coordinates are latitude first, which makes it the closest model to the Google Maps API. Its plugin ecosystem is the largest of the two.

The trade-off is the image: you can’t rotate or tilt the map, show 3D terrain, restyle the basemap in the browser or put your data below its labels. Choose it for simple store locators, embedded maps and dashboards, and wherever WebGL is not guaranteed. See the Leaflet examples. If you need vector tiles in a Leaflet app, Vector Tiles in Leaflet shows the bridge to MapLibre.

The same map in each

A map of Vienna with the Summer style and a marker.

const map = new maplibregl.Map({
  container: "map",
  style: `https://styles.maptoolkit.net/maptoolkit/maptoolkit.summer.json?api_key=${API_KEY}`,
  center: [16.3722, 48.2082],
  zoom: 13,
  attributionControl: { compact: false },
});
new maplibregl.Marker().setLngLat([16.3722, 48.2082]).addTo(map);

Leaflet’s zoom is one higher for the same view: its tiles are 256 px, the vector tiles 512 px.

The APIs work with both

Routing, geocoding, isochrones, elevation, weather and the Matrix API are HTTP requests, not part of a library, so the choice of library does not limit which services you can use. Most API pages have examples in both, for example the Routing API examples and the Isochrone API examples.

Switching later

Moving between Leaflet and MapLibre GL JS is a rewrite of the map code: different objects, different coordinate order, and data drawn as layers instead of objects. The service calls stay the same. Migrate from Google Maps walks through the translation for both. Mapbox GL JS and OpenLayers also work with Maptoolkit tiles, see below.


All supported libraries

MapLibre GL JS

MapLibre GL JS is an open-source, community-maintained fork of Mapbox GL JS. It renders vector tiles using WebGL and is fully compatible with Maptoolkit’s vector tile styles.

Supports vector tiles. Advantages: large and active community, no licensing costs, and an API that is essentially identical to Mapbox GL JS - code written for MapLibre is straightforward to port to Mapbox and vice versa.


Mapbox GL JS

Mapbox GL JS is Mapbox’s own vector map library and is fully compatible with Maptoolkit’s vector tile styles. It provides a polished SDK with a large ecosystem of plugins and extensions.

Supports vector tiles. Note that Mapbox GL JS requires a Mapbox access token in addition to your Maptoolkit API key, even when serving tiles from Maptoolkit.


Leaflet

Leaflet is a lightweight, battle-tested library for raster tile maps. It is the most widely used JavaScript mapping library and works in all browsers without WebGL.

Supports raster tiles (via Maptoolkit’s Raster Tiles API). Advantages: minimal bundle size, a very simple and well-documented API, a huge plugin ecosystem, and broad browser compatibility - an excellent fit for simple map integrations.


OpenLayers

OpenLayers is a full-featured open-source GIS library suitable for complex geospatial applications. It supports both raster and vector tiles natively (vector tiles via the ol-mapbox-style plugin).

Supports both vector tiles and raster tiles. Advantages: advanced GIS capabilities including WMS and WFS support, making it well-suited for applications that need to consume or expose geospatial data services beyond simple basemaps.