ts-maps

API reference

On this page 4

This section documents the public ts-maps API. For the full signature of every method, see the generated .d.ts declarations shipped with the package.

Overview

  • TsMap — the interactive map class; camera, sources,

    layers, events, style spec.

  • Layers — TileLayer, VectorTileMapLayer, Marker,

    Popup, Polyline, Polygon, Rectangle, Circle, CircleMarker, HeatmapLayer, RasterDEMLayer, ImageOverlay, VideoOverlay, SVGOverlay, LayerGroup, FeatureGroup, GeoJSON.

  • Geometry — LatLng, LatLngBounds, Point,

    Bounds, Transformation.

  • Expressions — style-spec expression operators

    (get, match, interpolate, …).

Services

Import from ts-maps/services:

import {
  defaultGeocoder,
  defaultDirections,
  defaultIsochrone,
  defaultMatrix,
  GeocoderProvider,
  DirectionsProvider,
  IsochroneProvider,
  MatrixProvider,
} from 'ts-maps/services'

Providers: OsmNominatim, Photon, Mapbox, Maptiler, Google (geocoding); OSRM, Valhalla, Mapbox, Google (directions).

Style spec

Import from ts-maps/style-spec:

import { validateStyle, compileExpression } from 'ts-maps/style-spec'

Storage

Import from ts-maps/storage:

import { TileCache, saveOfflineRegion, cachedFetch } from 'ts-maps/storage'