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.

Places Layers API (1) expand_less

Mapbox-GL Places Layers

Statistics Layers API (1) expand_less

Mapbox-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

Mapbox-GL Basic Isochrones

Mapbox-GL GeoJSON - Clipped

Mapbox-GL Inverse Isochrones

Mapbox-GL Isochrones with Polygon Source

Travel Time API (2) expand_less

Leaflet Travel Time API

Mapbox-GL Filter by Travel Time

Multigraph API (3) expand_less

GoogleMaps Tiled Multigraph

Mapbox-GL Tiled Multigraph

Visualize Multigraph with

Places Context API (2) expand_less

Mapbox-GL Places Context

Mapbox-GL Tiled Places Context

Statistics Context API (2) expand_less

Charting Reachable Statistics

Mapbox-GL Statistics Context

Routing API (4) expand_less

Google Maps Routing API

Leaflet Routing API

Leaflet Routing API GeoJSON Results

Mapbox-GL Routing API

Fleet API (1) expand_less

Mapbox-GL Planning Multi-stop Scenarios