ts-maps

Layer classes

On this page 10

Every layer exported from ts-maps descends from the abstract Layer class. Most have a matching lowercase factory helper — both forms are public API.

Base

ClassSignature
LayerAbstract base. .addTo(map), .remove(), .on/off, .bindPopup(), .bindTooltip().
LayerGroupnew LayerGroup(layers?). .addLayer/removeLayer, .eachLayer, .getLayers.
FeatureGroupExtends LayerGroup with forwarded events and .getBounds().

Markers

ClassSignature
Markernew Marker(latlng, options?) — draggable, with optional icon / title / alt / rise-on-hover.
Iconnew Icon({ iconUrl, iconSize, iconAnchor, popupAnchor, shadowUrl? }).
DefaultIconBuilt-in default marker icon.
DivIconnew DivIcon({ html, className, iconSize, iconAnchor }) — DOM-based icon.
ClassSignature
Popupnew Popup(options?, source?).setLatLng(ll).setContent(html).openOn(map).
TooltipLike Popup but lighter; binds via layer.bindTooltip(...).

Raster tiles

ClassSignature
GridLayerAbstract grid-of-tiles layer. Subclass to implement createTile.
TileLayernew TileLayer(urlTemplate, options?). Options: tileSize, minZoom, maxZoom, subdomains, attribution, cache.
WMSTileLayertileLayer.wms(baseUrl, { layers, styles?, format? }).
RasterDEMLayernew RasterDEMLayer(urlTemplate, { encoding, exaggeration, sun }) — hillshade.

Vector tiles

ClassSignature
VectorTileMapLayervectorTileLayer({ url, tileSize, layers }). Exposes queryRenderedFeatures(pt).

Data layers

ClassSignature
GeoJSONnew GeoJSON(geojson, { style, pointToLayer, onEachFeature, filter }).
GeoJSONClusterSourcenew GeoJSONClusterSource({ radius, maxZoom, minZoom, minPoints, reduce, map }).load(features).
HeatmapLayernew HeatmapLayer({ data, radius, blur, gradient, max, minOpacity }).

Overlays

ClassSignature
ImageOverlaynew ImageOverlay(url, bounds, options?).
VideoOverlaynew VideoOverlay(urlOrUrls, bounds, options?).
SVGOverlaynew SVGOverlay(svgEl, bounds, options?).

Vector paths

ClassSignature
Polylinenew Polyline(latlngs, options?).
Polygonnew Polygon(latlngs, options?).
Rectanglenew Rectangle(bounds, options?).
Circlenew Circle(latlng, { radius, ...pathOptions }).
CircleMarkernew CircleMarker(latlng, { radius, ...pathOptions }).

Controls

ClassSignature
ControlAbstract base. .addTo(map), .setPosition(pos).
ZoomControlcontrol.zoom({ position? }).
AttributionControlcontrol.attribution({ prefix? }).
ScaleControlcontrol.scale({ metric?, imperial? }).
LayersControlcontrol.layers(baseLayers, overlays, { collapsed? }).

Symbols

ClassSignature
GlyphAtlasSDF glyph atlas used by text symbols.
IconAtlasSprite sheet manager.
CollisionIndexPriority-based collision detection for placed labels.