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) expand_less

Targomo Basemap Switcher

Places Layers API (2) expand_less

Maplibre-GL Places Layers

Places Layers API by BBox

Statistics Layers API (1) expand_less

Maplibre-GL Statistics Layers MVT

Isochrone API (19) expand_less

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) expand_less

Leaflet Travel Time API

Maplibre-GL Filter by Travel Time

Multigraph API (3) expand_less

GoogleMaps Tiled Multigraph

Maplibre-GL Tiled Multigraph

Visualize Multigraph with

Places Context API (2) expand_less

Maplibre-GL Places Context

Maplibre-GL Tiled Places Context

Statistics Context API (2) expand_less

Charting Reachable Statistics

Maplibre-GL Statistics Context

Location Scoring API (3) expand_less

Location Scoring - Closest POI

Location Scoring - Reachable POI Count

Location Scoring - Statistics Criteria

Routing API (5) expand_less

Google Maps Routing API

Leaflet Routing API

Leaflet Routing API GeoJSON Results

Maplibre-GL Routing API

Time vs Distance Routing

Fleet API (1) expand_less

Maplibre-GL Planning Multi-stop Scenarios