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

Image

Targomo Basemap Switcher

Places Layers API (2) expand_less

Image

Maplibre-GL Places Layers

Image

Places Layers API by BBox

Statistics Layers API (2) expand_less

Image

Maplibre-GL Statistics Breakpoints

Image

Maplibre-GL Statistics Layers MVT

Isochrone API (19) expand_less

Image

Basic Google Maps Isochrones

Image

Basic Leaflet Isochrones

Image

Google Maps Inverse Isochrones

Image

Google Maps Isochrones Without Client Library

Image

Isochrone Polygons vs Radius

Image

Leaflet Customize Bike Speed

Image

Leaflet GeoJSON Isochrones

Image

Leaflet Inverse Isochrones

Image

Leaflet Isochrone Colors Legend

Image

Leaflet Isochrones Intersection Modes

Image

Leaflet Isochrones Minimum Hole Size

Image

Leaflet Isochrones with Custom Colors

Image

Leaflet Isochrones with Traffic Congestion

Image

Leaflet Time vs Distance Edge Weight

Image

Leaflet Travel Mode Isochrones

Image

Maplibre-GL Basic Isochrones

Image

Maplibre-GL GeoJSON - Clipped

Image

Maplibre-GL Inverse Isochrones

Image

Maplibre-GL Isochrones with Polygon Source

Travel Time API (2) expand_less

Image

Leaflet Travel Time API

Image

Maplibre-GL Filter by Travel Time

Multigraph API (3) expand_less

Image

GoogleMaps Tiled Multigraph

Image

Maplibre-GL Tiled Multigraph

Image

Visualize Multigraph with Deck.gl

Places Context API (2) expand_less

Image

Maplibre-GL Places Context

Image

Maplibre-GL Tiled Places Context

Statistics Context API (2) expand_less

Image

Charting Reachable Statistics

Image

Maplibre-GL Statistics Context

Location Scoring API (3) expand_less

Image

Location Scoring - Closest POI

Image

Location Scoring - Reachable POI Count

Image

Location Scoring - Statistics Criteria

Routing API (5) expand_less

Image

Google Maps Routing API

Image

Leaflet Routing API

Image

Leaflet Routing API GeoJSON Results

Image

Maplibre-GL Routing API

Image

Time vs Distance Routing

Fleet API (1) expand_less

Image

Maplibre-GL Planning Multi-stop Scenarios