ts-maps

ts-maps

Interactive maps in TypeScript

Vector basemaps, 3D, a globe, search, directions and offline maps, with no dependencies. Leaflet's API, the Mapbox style spec.

ts-maps
🗺️

A basemap with no key

styles.light and styles.dark draw any OpenMapTiles source, such as OpenFreeMap's free planet. Tiles are decoded on worker threads; labels are placed without overlapping and stay upright as the map turns.

🧱

The Mapbox style spec

Sources and style layers — fill, line, circle, symbol, fill-extrusion, heatmap, hillshade — with data-driven expressions, filters, feature state and queryRenderedFeatures.

🎥

Camera

Fractional zoom, rotation, and tilt to 85° with a sky at the horizon. flyTo, easeTo and jumpTo, and two-finger twist and tilt on touch screens.

🏙️

3D

Extruded buildings with roofs, glTF landmarks and trees, drawn together in WebGL so each hides what is behind it. Terrain raised from elevation tiles, with labels and markers standing on it; hillshading, fog, sky, and custom WebGL layers.

🌍

The globe

projection: 'globe' draws a WebGL sphere textured with the same tiles as the flat map, and fades into the flat map between zoom 5.5 and 6. Labels and markers ride it.

🔎

Search

control.search(): suggestions as you type, Find Nearby, a pin per result and a card for each place, with opening hours, directions and saved places. Keyless geocoders by default.

🧭

Directions and turn-by-turn

Routes from OSRM or Valhalla with no key, and transit from an OpenTripPlanner server. turnByTurn(map) adds the route choices, a banner, lane guidance, a voice and a camera that follows.

📴

Offline maps

Download an area with control.offlineMaps() or map.offline. Its tiles, fonts, places and roads are kept in the browser, so the map, search and directions work with no connection.

🛰️

Map types and traffic

Explore, Driving, Transit and Satellite from one basemap, with control.mapType(). Live traffic from Mapbox or TomTom flow tiles, and TomTom incidents, with your key.

🏢

Indoor maps and Look Around

Floor plans from IMDF venues, a level at a time, searchable by name. Street-level imagery from Panoramax or Mapillary, to look around and walk through.

🗄️

Your own tiles

pmtiles:// archives read in place, with no tile server. Or serve one: ts-maps/server for Bun, ts-maps/worker for Cloudflare. ts-maps/gazetteer for your own place search.

🌐

Localization

One locale option sets the language of every control, turn-by-turn and its voice. English and German built in; addMessages adds another.

🧩

Framework bindings

React, Vue, Svelte, Solid, Nuxt, React Native and stx, with the same component names, props and events in each.