Code Examples
This section contains code examples for our JavaScript/TypeScript API. We try to keep these code examples as simple and short as possible. Each code example is supposed to show you how to do one specific thing with our library. For example, a code example will tell you: “How to display isochrones in Google Maps”.
You can run these code examples locally simply by copying the entire content of a code example into a local file, and replacing __targomo_key_here__
with your own Targomo API key.
Basemaps API (1)

Targomo Basemap Switcher
Places Layers API (2)

Maplibre-GL Places Layers

Places Layers API by BBox
Statistics Layers API (1)

Maplibre-GL Statistics Layers MVT
Isochrone API (19)

Basic Google Maps Isochrones

Basic Leaflet Isochrones

Google Maps Inverse Isochrones

Google Maps Isochrones Without Client Library

Isochrone Polygons vs Radius

Leaflet Customize Bike Speed

Leaflet GeoJSON Isochrones

Leaflet Inverse Isochrones

Leaflet Isochrone Colors Legend

Leaflet Isochrones Intersection Modes

Leaflet Isochrones Minimum Hole Size

Leaflet Isochrones with Custom Colors

Leaflet Isochrones with Traffic Congestion

Leaflet Time vs Distance Edge Weight

Leaflet Travel Mode Isochrones

Maplibre-GL Basic Isochrones

Maplibre-GL GeoJSON - Clipped

Maplibre-GL Inverse Isochrones

Maplibre-GL Isochrones with Polygon Source
Travel Time API (2)

Leaflet Travel Time API

Maplibre-GL Filter by Travel Time
Multigraph API (3)

GoogleMaps Tiled Multigraph

Maplibre-GL Tiled Multigraph

Visualize Multigraph with Deck.gl
Places Context API (2)

Maplibre-GL Places Context

Maplibre-GL Tiled Places Context
Statistics Context API (2)

Charting Reachable Statistics

Maplibre-GL Statistics Context
Location Scoring API (3)

Location Scoring - Closest POI

Location Scoring - Reachable POI Count

Location Scoring - Statistics Criteria
Routing API (5)

Google Maps Routing API

Leaflet Routing API

Leaflet Routing API GeoJSON Results

Maplibre-GL Routing API

Time vs Distance Routing
Fleet API (1)
