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 polygons 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.

Polygon (16) expand_less

Basic Google Maps Isochrones

Basic Leaflet Isochrones

Google Maps Inverse Polygons

Leaflet GeoJSON Polygons

Leaflet Inverse Polygons

Leaflet Polygon Colors Legend

Leaflet Polygon Intersection Modes

Leaflet Polygon Minimum Hole Size

Leaflet Polygons with Custom Colors

Leaflet Polygons with Traffic Congestion

Leaflet Time vs Distance Edge Weight

Leaflet Travel Mode Polygons

Mapbox-GL Basic Isochrones

Mapbox-GL GeoJSON - Clipped

Mapbox-GL Inverse Polygons

Mapbox-GL Isochrones with Polygon Source

Multigraph (3) expand_less

GoogleMaps Tiled Multigraph

Mapbox-GL Tiled Multigraph

Visualize Multigraph with Deck.gl

Points of interest (3) expand_less

Mapbox-GL Reachable Points of Interest

Mapbox-GL Tiled Points of Interest

Mapbox-GL Tiled, Reachable POIs

Reachability (2) expand_less

Leaflet Reachability Service

Mapbox-GL Filter by Reachability

Routing (4) expand_less

Google Maps Routing Service

Leaflet Routing Service

Leaflet Routing Service GeoJSON Results

Mapbox-GL Routing Service

Statistics (2) expand_less

Charting Reachable Statistics

Mapbox-GL Statistics-based Reachability

Fleetplanner (1) expand_less

Mapbox-GL Planning Multi-stop Scenarios