ts-maps

01 · Basic map

A vector basemap, a draggable marker and its popup: the least a map needs. The basemap is OpenFreeMap's planet, free and keyless, drawn with the built-in light style. url names its TileJSON, which the map reads for the tiles.

Open it full screen · Edit and run it · Full source: 01-basic-map.ts

import { DivIcon, Map, Marker, styles } from 'ts-maps'

const map = new Map('map', {
  center: [40.758, -73.9855],
  zoom: 14,
  style: styles.light({ url: 'https://tiles.openfreemap.org/planet' }),
})

new Marker([40.758, -73.9855], { icon: new DivIcon({ html: '<div class="pin"></div>' }), draggable: true })
  .addTo(map)
  .bindPopup('<b>Hello from ts-maps</b>')
  .openPopup()

← Examples · Camera →