API Reference

Complete reference for all map components and their inputs and outputs.

Note: This library is built on top of MapLibre GL JS. Most components extend the native MapLibre options. Refer to the MapLibre Map API for additional options not listed here.

Component Anatomy

#

All parts of the component set you can use and combine to build your map.

<ng-map [center]="[-74.006, 40.7128]" [zoom]="11">
  <ng-map-controls />

  <ng-map-marker [longitude]="-74.006" [latitude]="40.7128">
    <ng-marker-content>
      <div class="size-4 rounded-full bg-blue-500"></div>
      <ng-marker-label position="top">New York</ng-marker-label>
    </ng-marker-content>
    <ng-marker-tooltip>Hover content</ng-marker-tooltip>
    <ng-marker-popup>Click content</ng-marker-popup>
  </ng-map-marker>

  <ng-map-popup [longitude]="-74" [latitude]="40.7">Standalone popup</ng-map-popup>
  <ng-map-route [coordinates]="coordinates" />
  <ng-map-arc [data]="arcs" />
  <ng-map-geojson [data]="geojson" />
  <ng-map-cluster-layer [data]="points" />
  <ng-map-heatmap [data]="points" weightProperty="mag" />
  <ng-map-raster-source id="radar" [tiles]="radarTiles" [opacity]="0.7" />
  <ng-map-vector-source id="parcels" url="pmtiles://https://example.com/parcels.pmtiles" />
  <ng-map-image-overlay [url]="imageUrl" [coordinates]="corners" />
</ng-map>

Map

#

ng-map

The root container component that initializes MapLibre GL and provides context to child components. Automatically handles theme switching between light and dark modes.

Inputs

InputTypeDefaultDescription
center[number, number][0, 0] Initial center coordinates as [longitude, latitude].
zoomnumber2 Initial zoom level of the map.
stylesMapStylesConfigCARTO Custom style URLs or style objects for light and dark themes.
blankbooleanfalse Swaps the basemap for a transparent, tile-less canvas. Add your own layers on top.
projectionProjectionSpecification— Map projection, e.g. { type: 'globe' }.
theme'light' | 'dark' | 'auto''auto' Force a theme, or 'auto' to follow the dark/light class on <html>.
loadingbooleanfalse Shows the loading overlay.
labelsPartial<MapLabels>— Label overrides (loading), merged over provideMapLabels() and the English defaults.
viewportPartial<MapViewport>— Controlled viewport ({ center, zoom, bearing, pitch }). Pair with viewportChange.
fitBoundsMapFitBoundsOptions— Fits the camera to bounds ({ bounds?, padding?, maxZoom?, duration?, animate? }). Without bounds it fits the union of the children's data (markers, GeoJSON, routes, arcs, clusters, heatmaps). Runs after load and refits only when the bounds change; the first fit never animates; maxZoom defaults to 16. A draggable marker bound to signals refits while dragged: pass explicit bounds for that case. Imperative form: MapContextService.fitBounds().
optionsOmit<MapOptions, 'container' | 'style'>— Extra MapLibre MapOptions (scrollZoom, dragRotate, …) passed to the map constructor.

Outputs

OutputTypeDefaultDescription
viewportChangeMapViewport— Emits on every viewport change (move, zoom, rotate, pitch).
mapReadyMap— Emits the raw maplibre-gl Map instance once loaded.
mapClickMapMouseEvent— Emits when the map is clicked.
mapErrorError— Emits when the map fails to initialize or load.

MapControls

#

ng-map-controls

Renders map control buttons: zoom, compass, locate, and fullscreen. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
position'top-left' | 'top-right' | 'bottom-left' | 'bottom-right''bottom-right' Corner of the map to place the controls in.
showZoombooleantrue Show zoom in/out buttons.
showCompassbooleanfalse Show compass button (resets bearing).
showLocatebooleanfalse Show geolocate button.
showFullscreenbooleanfalse Show fullscreen toggle button.
labelsPartial<MapLabels>— Label overrides (zoomIn, zoomOut, resetNorth, locate, fullscreen), merged over provideMapLabels() and the English defaults.
classNamestring— Extra space-separated classes added to the rendered .ng-controls element. Reactive; the built-in class is always kept.

Outputs

OutputTypeDefaultDescription
locateChange{ longitude: number; latitude: number }— Emits the user position after a successful locate.
locateErrorGeolocationPositionError | Error— Emits when locating fails (denied, timeout) or when the browser has no geolocation.

MapMarker

#

ng-map-marker

A container for marker-related components. Provides context for its children and handles marker positioning.

Inputs

InputTypeDefaultDescription
longitudenumberrequired Longitude coordinate of the marker.
latitudenumberrequired Latitude coordinate of the marker.
draggablebooleanfalse Allows the marker to be dragged.
offsetPointLike— Pixel offset applied to the marker element.
rotationnumber0 Rotation of the marker in degrees.
anchorPositionAnchor— Part of the marker element positioned at the coordinates.
rotationAlignment'map' | 'viewport' | 'auto''auto' How the marker rotates with the map.
pitchAlignment'map' | 'viewport' | 'auto''auto' How the marker tilts with the map pitch.
ariaLabelstring— Accessible name of the marker (aria-label). Interactive markers whose content has no text fall back to labels.marker ('Map marker'); a static labelled marker gets role="img".
labelsPartial<MapLabels>— Label overrides (marker), merged over provideMapLabels() and the English defaults.
keyboardStepnumber10 Pixels a draggable marker moves per arrow key press.
keyboardStepLargenumber50 Pixels per arrow key press while Shift is held.

Outputs

OutputTypeDefaultDescription
markerClickMouseEvent— Emits when the marker is clicked, or when Enter or Space (on keyup) is pressed on the focused marker, also with ng-marker-popup. Give icon-only clickable markers their own ariaLabel. A marker with this handler becomes a role=button tab stop.
markerMouseEnterMouseEvent— Emits when the pointer enters the marker.
markerMouseLeaveMouseEvent— Emits when the pointer leaves the marker.
dragStart{ lng: number; lat: number }— Emits when dragging starts.
drag{ lng: number; lat: number }— Emits continuously while dragging.
dragEnd{ lng: number; lat: number }— Emits the final position after dragging.

MarkerContent

#

ng-marker-content

Renders the visual content of a marker via content projection. If left empty, a default blue dot is rendered; it follows conditional content (shown while nothing is projected). Must be used inside ng-map-marker.

Inputs

InputTypeDefaultDescription
classNamestring— Extra space-separated classes added to the rendered .ng-marker-content element. Reactive; the built-in class is always kept.

MarkerLabel

#

ng-marker-label

An always-visible text label above or below the marker. Must be used inside ng-marker-content.

Inputs

InputTypeDefaultDescription
position'top' | 'bottom''top' Side of the marker the label appears on.

MarkerPopup

#

ng-marker-popup

A popup attached to the marker that opens on click. Must be used inside ng-map-marker. Keyboard: the marker becomes a focusable role=button with aria-haspopup=dialog (unless you set them), Enter/Space opens it, focus moves into the popup, and Escape closes it, stops propagation and returns focus to the marker. Avoid your own <button> inside ng-marker-content (nested interactive content).

Inputs

InputTypeDefaultDescription
closeButtonbooleanfalse Shows a close button in the popup.
offsetOffset— Pixel offset from the marker. Reconciled live via setOffset; MapLibre's default when unset.
anchorPositionAnchor— Which side of the marker the popup anchors to. Applied at creation only.
maxWidthstring'none' CSS max-width of the popup container. Reconciled live via setMaxWidth.
closeOnClickbooleanfalse Closes the popup when the map is clicked. Applied at creation only.
labelsPartial<MapLabels>— Label overrides (closePopup), merged over provideMapLabels() and the English defaults.
classNamestring— Extra space-separated classes added to the rendered .ng-popup-card element. Reactive; the built-in class is always kept.

Outputs

OutputTypeDefaultDescription
popupClosevoid— Emits when the popup closes.

MarkerTooltip

#

ng-marker-tooltip

A tooltip that appears on marker hover and keyboard focus (Escape or blur closes it; the marker becomes a tab stop). Must be used inside ng-map-marker.

Inputs

InputTypeDefaultDescription
offsetOffset16 Pixel distance between the marker and the tooltip.
anchorPositionAnchor— Which side of the coordinates the tooltip anchors to.
classNamestring— Extra space-separated classes added to the rendered .ng-tooltip-pill element. Reactive; the built-in class is always kept.

MapPopup

#

ng-map-popup

A standalone popup component that can be placed anywhere on the map without a marker. Must be used inside ng-map. Keyboard: focus moves into the popup when it opens, and Escape inside it closes it (stops propagation, so a host dialog stays open).

Inputs

InputTypeDefaultDescription
longitudenumberrequired Longitude coordinate of the popup.
latitudenumberrequired Latitude coordinate of the popup.
closeButtonbooleanfalse Shows a close button in the popup.
offsetOffset16 Pixel offset of the popup.
maxWidthstring'none' CSS max-width of the popup container.
closeOnClickbooleantrue Closes the popup when the map is clicked. Applied at creation only. Set false for popups that follow the hover.
labelsPartial<MapLabels>— Label overrides (closePopup), merged over provideMapLabels() and the English defaults.
classNamestring— Extra space-separated classes added to the rendered .ng-popup-card element. Reactive; the built-in class is always kept. Pass ng-popup-passthrough to make the whole popup non-interactive (pointer-events: none), so a hover popup does not capture the cursor and close itself.
openbooleantrue Whether the popup is shown. Two-way bindable with [(open)]: closing it writes false, setting true opens it again at the current position.

Outputs

OutputTypeDefaultDescription
popupClosevoid— Emits when the popup closes, by the user or by setting open to false.
openChangeboolean— Emits the new open state (the [(open)] binding).

MapRoute

#

ng-map-route

Renders a line/route from the given coordinates. Must be used inside ng-map. Supports click and hover interactions, an active (highlighted) state and a covered-progress line via child ng-route-progress / ng-route-marker components.

Inputs

InputTypeDefaultDescription
coordinates[number, number][]required Array of [longitude, latitude] points forming the line.
idstringauto Optional stable id for the underlying source/layer.
colorstring'#4285F4' Line color.
widthnumber3 Line width in pixels.
opacitynumber0.8 Line opacity.
dashArraynumber[]— Dash pattern, e.g. [2, 2].
interactivebooleantrue Enables pointer events on the line.
beforeIdstring— Id of an existing layer to insert the route (and its progress line) below. Applied at creation only.
progressnumber— Covered fraction of the route (0 to 1). Drawn by a child ng-route-progress and followed by ng-route-marker at="progress".
activebooleanfalse Highlights the route: the active* inputs override the base paint while true.
activeColorstring— Line color while active. Falls back to color.
activeWidthnumber— Line width while active. Falls back to width.
activeOpacitynumber— Line opacity while active. Falls back to opacity.
activeDashArraynumber[]— Dash pattern while active. Falls back to dashArray.

Outputs

OutputTypeDefaultDescription
routeClickMapMouseEvent— Emits when the route is clicked.
routeMouseEnterMapMouseEvent— Emits when the pointer enters the route (the cursor becomes a pointer).
routeMouseLeaveMapMouseEvent— Emits when the pointer leaves the route.

RouteProgress

#

ng-route-progress

Draws the covered part of the parent ng-map-route, as set by its progress input (computed by cumulative distance along the line). Use inside ng-map-route.

Inputs

InputTypeDefaultDescription
colorstring'#22c55e' Color of the covered line.
widthnumberroute width Width of the covered line in pixels.
opacitynumber1 Opacity of the covered line.
dashArraynumber[]— Dash pattern of the covered line.

RouteMarker

#

ng-route-marker

A marker placed along the parent ng-map-route. Project ng-marker-content (and label, popup, tooltip) into it. Created once and moved as progress or coordinates change.

Inputs

InputTypeDefaultDescription
at'start' | 'end' | 'progress' | number'start' Position on the route: its start, end, the current progress, or a fraction between 0 and 1 of the total distance.

MapArc

#

ng-map-arc

Renders curved lines between coordinate pairs using quadratic Bézier interpolation, with longitude unwrapping across the antimeridian. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
dataMapArcDatum[]required Arcs to draw: { id, from: [lng, lat], to: [lng, lat] }. Extra properties are exposed to paint expressions.
idstringauto Optional stable id for the underlying source/layer.
curvaturenumber0.2 How much the arc bends.
samplesnumber64 Number of interpolation points per arc.
paintLineLayerSpecification["paint"]— MapLibre line paint properties.
layoutLineLayerSpecification["layout"]— MapLibre line layout properties.
hoverPaintLineLayerSpecification["paint"]— Paint overrides applied to the hovered arc via feature-state.
interactivebooleantrue Enables pointer events (adds an invisible hit layer).
beforeIdstring— Insert the layer before this layer id.

Outputs

OutputTypeDefaultDescription
arcClickMapArcEvent— Emits { arc, longitude, latitude, originalEvent } when an arc is clicked.
arcHoverMapArcEvent | null— Emits on hover; null when the pointer leaves.

MapGeoJSON

#

ng-map-geojson

Renders GeoJSON polygons and lines with theme-aware monochrome defaults and declarative feature-state hover. Accepts a URL or an inline GeoJSON object. Generic over the feature properties: MapGeoJSONComponent<P>, with P inferred from data. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
dataMapGeoJSONData<P>required GeoJSON object or URL string. P types the featureClick/featureHover payloads.
idstringauto Optional stable id for the underlying source/layer.
promoteIdstring— Feature property used as feature id — required for hover feature-state.
fillPaintFillLayerSpecification["paint"]theme mono Fill paint properties.
linePaintLineLayerSpecification["paint"]theme mono Outline paint properties.
fillHoverPaintFillLayerSpecification["paint"]— Fill paint overrides applied to the hovered feature.
interactivebooleanfalse Enables pointer events and hover tracking.
beforeIdstring— Insert the layers before this layer id.

Outputs

OutputTypeDefaultDescription
featureClickMapGeoJSONEvent<P>— Emits { feature, longitude, latitude, originalEvent } on click.
featureHoverMapGeoJSONEvent<P> | null— Emits on hover; null when the pointer leaves.

MapClusterLayer

#

ng-map-cluster-layer

Renders clustered points with MapLibre GL native clustering. Automatically styles cluster circles by point count, zooms in on cluster click. Generic over the feature properties: MapClusterLayerComponent<P>, with P inferred from data. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
datastring | FeatureCollection<Point, P>required GeoJSON points (object or URL string). P types the pointClick payload.
idstringauto Optional stable id prefix for the source and layers: cluster-source-<id>, clusters-<id>, cluster-count-<id>, unclustered-point-<id>. Changing it re-creates them.
beforeIdstring— Insert the cluster layers before this layer id. Applied at creation only.
clusterMaxZoomnumber14 Max zoom at which points are clustered.
clusterRadiusnumber50 Cluster radius in pixels.
clusterColors[string, string, string]['#22c55e', '#eab308', '#ef4444'] Circle colors for small/medium/large clusters. ng-mapcn defaults to green/yellow/red; mapcn uses ['#3b82f6', '#1d4ed8', '#1e3a8a'].
clusterThresholds[number, number][100, 750] Point-count thresholds between color tiers.
pointColorstring'#3b82f6' Color of unclustered points.
zoomOnClusterClickbooleantrue Zooms into a cluster when it is clicked.

Outputs

OutputTypeDefaultDescription
pointClickClusterPointClickEvent<P>— Emits { feature, coordinates } when an unclustered point is clicked.
clusterClickClusterClickEvent— Emits { clusterId, coordinates, pointCount } when a cluster is clicked.

MapHeatmap

#

ng-map-heatmap

Renders GeoJSON points as a MapLibre heatmap layer with a theme-aware default gradient. Generic over the feature properties: MapHeatmapComponent<P>, with P inferred from data. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
datastring | FeatureCollection<Point, P>required GeoJSON points (object or URL string).
idstringauto Optional stable id prefix for the source and layer: heatmap-source-<id>, heatmap-layer-<id>. Changing it re-creates them.
beforeIdstring— Insert the layer before this layer id. Applied at creation only.
weightPropertystring— Numeric feature property used as the point weight. Without it every point weighs the same.
weightRange[number, number][0, 1] [min, max] of weightProperty, mapped linearly to a weight of 0..1.
radiusnumber | expression30 Influence radius of each point in pixels. Accepts MapLibre expressions.
intensitynumber | expression1 Global intensity multiplier. Accepts MapLibre expressions.
opacitynumber | expression1 Layer opacity. Accepts MapLibre expressions.
gradientHeatmapGradienttheme default Color stops [density 0..1, color]. Sorted, with a transparent stop at 0 prepended when missing. Defaults to defaultHeatmapGradients for the resolved theme.
minZoomnumber0 Minimum zoom at which the heatmap is rendered.
maxZoomnumber24 Zoom from which the heatmap is no longer rendered (e.g. to hand over to a point layer).
paintHeatmapLayerSpecification["paint"]— Escape hatch: heatmap paint properties merged last.

MapRasterSource

#

ng-map-raster-source

Raster tile source (XYZ, TMS, WMS) plus the raster layer that draws it. Source and layer are re-added after a theme switch. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
idstringauto MapLibre source id, used verbatim (other components reference it as source: id). The layer is raster-layer-<id>. Changing it re-creates both.
tilesstring[]— Tile URL templates ({z}/{x}/{y}, {bbox-epsg-3857} for WMS). Updated in place with setTiles.
urlstring— TileJSON URL, instead of tiles (takes precedence). Updated in place with setUrl.
tileSizenumber256 Tile size in pixels. Applied at creation.
minzoomnumber0 Minimum tile zoom. Applied at creation.
maxzoomnumber22 Maximum tile zoom. Applied at creation.
attributionstring— Attribution for the map attribution control. Applied at creation.
bounds[number, number, number, number]— [west, south, east, north] limit of the tiles. Applied at creation.
scheme'xyz' | 'tms''xyz' Tile addressing scheme. Applied at creation.
opacitynumber | expression1 Raster layer opacity (raster-opacity).
visiblebooleantrue Whether the layer is drawn; the source stays loaded when hidden.
beforeIdstring— Insert the layer before this layer id. Applied at creation only.
paintRasterLayerSpecification["paint"]— Escape hatch: raster paint properties merged last.

MapVectorSource

#

ng-map-vector-source

Vector tile source (MVT, TileJSON or pmtiles://). Adds the source only: draw it with layers that reference it by id and wait for it with MapContextService.hasSource(id). ng-mapcn does not depend on pmtiles; register the protocol yourself with maplibregl.addProtocol. When torn down or the style reloads it removes every layer still using the source, then the source: gate your layers on hasSource(id). tiles vs url mode is fixed at creation. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
idstringauto MapLibre source id, used verbatim; layers reference it as source: id. Announced through MapContextService.hasSource(id) while it exists. Changing it re-creates the source.
tilesstring[]— Tile URL templates. Updated in place with setTiles.
urlstring— TileJSON URL or pmtiles://<archive url> (register the pmtiles protocol first), instead of tiles. Updated in place with setUrl.
minzoomnumber0 Minimum tile zoom. Applied at creation.
maxzoomnumber22 Maximum tile zoom. Applied at creation.
attributionstring— Attribution for the map attribution control. Applied at creation.
bounds[number, number, number, number]— [west, south, east, north] limit of the tiles. Applied at creation.
scheme'xyz' | 'tms''xyz' Tile addressing scheme. Applied at creation.
promoteIdstring | Record<string, string>— Feature property (or per source-layer map) used as the feature id, which enables feature-state on vector tiles. Applied at creation.

MapImageOverlay

#

ng-map-image-overlay

Georeferenced image pinned to four corner coordinates, drawn as a raster layer. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
idstringauto MapLibre image source id, used verbatim. The layer is image-layer-<id>. Changing it re-creates both.
urlstringrequired Image URL. Changing it calls updateImage on the live source.
coordinatesImageOverlayCoordinatesrequired Four [lng, lat] corners, clockwise from the top-left. Changing them calls setCoordinates.
opacitynumber | expression1 Layer opacity (raster-opacity).
visiblebooleantrue Whether the layer is drawn.
beforeIdstring— Insert the layer before this layer id. Applied at creation only.
paintRasterLayerSpecification["paint"]— Escape hatch: raster paint properties merged last (e.g. raster-fade-duration: 0 to avoid a flash on url change).

MapFillExtrusion

#

ng-map-fill-extrusion

3D extrusion of polygons (fill-extrusion layer), e.g. 3D buildings. Creates only the layer: the source is a basemap source or one added by a source component or the application, and the layer waits for it. Re-added after a theme switch. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
idstringauto Layer id prefix; the layer is fill-extrusion-layer-<id>. Changing it re-creates the layer.
sourcestringCarto basemap source Id of the source to extrude: a tile source component, an application source or a basemap source. Without it, the Carto basemap's building source is used ('protomaps', or 'carto' in the earlier styles). The layer is added once map.getSource(source) exists.
sourceLayerstring'buildings' for 'protomaps', 'building' for 'carto', else none Layer of a vector source. Omit for GeoJSON sources.
heightPropertystring'height' for 'protomaps', else 'render_height' Feature property with the height in meters.
basePropertystring'min_height' for 'protomaps', else 'render_min_height' Feature property with the base height in meters.
colorstring | expressiontheme gray Fill color; defaults to a theme-aware gray (defaultExtrusionColors).
opacitynumber0.8 Layer opacity, 0..1.
minZoomnumber14 Minimum zoom at which the extrusion is drawn (the Carto tiles stop at 14).
maxZoomnumber24 Zoom from which the extrusion is no longer drawn.
filterFilterSpecification | null['!=', ['get', 'hide_3d'], true] MapLibre filter, updated with setFilter. null removes the default filter.
beforeIdstring— Insert the layer before this layer id. Applied at creation only.
paintFillExtrusionLayerSpecification["paint"]— Escape hatch: fill-extrusion paint properties merged last.

MapTerrain

#

ng-map-terrain

3D terrain from a raster-dem source (map.setTerrain) with an optional hillshade layer. The terrain is style-level state: it is re-applied after a theme switch and disabled on teardown. One terrain per map. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
idstringauto Id prefix: DEM source terrain-source-<id>, hillshade source terrain-hillshade-source-<id>, hillshade layer terrain-hillshade-<id>. Changing it re-creates all.
tilesstring[]public Terrarium tiles Elevation tile URL templates. Applied at creation.
urlstring— TileJSON URL, instead of tiles (takes precedence). Applied at creation.
encoding'terrarium' | 'mapbox''terrarium' Encoding of the elevation tiles. Applied at creation.
tileSizenumber256 Tile size in pixels. Applied at creation.
minzoomnumber— Minimum zoom of the elevation tiles. Applied at creation.
maxzoomnumber15 for the default tiles Maximum zoom of the elevation tiles. Applied at creation.
attributionstringMapzen / AWS for the default tiles Attribution for the map attribution control. Applied at creation.
exaggerationnumber1 How tall the terrain looks. Changing it calls setTerrain again.
hillshadebooleanfalse Draw a hillshade layer (with its own DEM source). Added and removed on toggle; the terrain is untouched.
hillshadeExaggerationnumber— Hillshade intensity, 0..1 (MapLibre default 0.5).
hillshadeShadowColorstring— Hillshade color of the shaded slopes.
hillshadeHighlightColorstring— Hillshade color of the lit slopes.
hillshadeAccentColorstring— Hillshade accent color for steep slopes.
hillshadePaintHillshadeLayerSpecification["paint"]— Escape hatch: hillshade paint properties merged last.
beforeIdstring— Insert the hillshade layer before this layer id. Applied when the layer is created only.

MapDraw

#

ng-map-draw

Draws, selects and edits points, lines and polygons on terra-draw. Lives in the optional ng-mapcn/draw entry point (import { MapDrawComponent } from 'ng-mapcn/draw') and needs the terra-draw and terra-draw-maplibre-gl-adapter peer dependencies. A theme switch (setStyle) stops and restarts terra-draw with the same features and mode. Must be used inside ng-map.

Inputs

InputTypeDefaultDescription
modes('point' | 'line' | 'polygon')[]all three Shapes the user can draw. Changing it restarts terra-draw with the same features and drops an unfinished shape.
mode'point' | 'line' | 'polygon' | 'select' | 'static''static' Active tool (two-way with [(mode)]). A mode that is not enabled falls back to 'static'.
featuresFeatureCollectionempty Drawn features as a GeoJSON FeatureCollection of Point, LineString and Polygon (two-way with [(features)]). Updates when a draw, edit or delete completes. Assigning a collection diffs by feature id; features keep their own ids (any non-empty string or finite number) and those without one get an id; unsupported geometries are dropped and reported through mapError.
editablebooleantrue Enables the select mode: select, drag, reshape and delete features. Changing it restarts terra-draw and drops an unfinished shape.
color`#${string}`theme default Accent color of the drawn shapes (#rrggbb). Defaults to a theme-aware blue. Changing it restyles the modes in place (no restart).

Outputs

OutputTypeDefaultDescription
drawEndMapDrawEvent— Emits { feature, mode, action } when a new shape is completed.
featureEditMapDrawEvent— Emits { feature, mode, action } when an existing feature is moved, reshaped or otherwise edited.
featureSelectMapDrawFeature— Emits the selected Feature (select mode).
featureDeselectstring | number— Emits the id of the deselected feature.

MapContextService

#

Component-scoped service provided by ng-map - the Angular equivalent of mapcn's useMap() hook. Inject it in any component projected inside ng-map to access the raw map.

MemberTypeDefaultDescription
map()Signal<Map | null>— The raw maplibre-gl Map instance, or null before init.
isLoaded()Signal<boolean>— True when the style is loaded and layers can be added. Gates every source/layer operation; closes during a theme/basemap switch and re-opens once it settles (or fails).
resolvedTheme()Signal<'light' | 'dark'>— Theme currently applied to the map.
hasSource(id)(id: string) => boolean— Whether a source component (raster, vector, image overlay) currently has a source with this id on the map. Reactive inside effect(); false while a theme switch has removed the style. Wait on it before adding layers that reference source: id.
sourceIds()Signal<ReadonlySet<string>>— Ids of the sources currently announced by source components.
registerSource(id)(id: string) => () => void— Announces a source you added yourself so hasSource(id) sees it; returns the release function to call when you remove it.
fitBounds(options?)(options?: MapFitBoundsOptions) => boolean— Fits the camera to options.bounds, or to the union of the children's data. Returns false when the map is not loaded or there are no bounds.
dataBounds()Signal<[number, number, number, number] | null>— Union of the bounds registered by the children, as [west, south, east, north].
registerBounds(getter)(getter: () => LngLatBoundsLike | null) => () => void— Contributes a bounds source to fit-to-bounds. The getter runs reactively; returns the unregister function (call it on destroy).

provideMapStyles()

#

Sets the app-wide default basemap through the MAP_DEFAULT_STYLES token. Every ng-map without its own styles input (and without blank) uses it; pass a signal to swap the basemap at runtime. Precedence: styles → blank → provideMapStyles() → Carto default.

import { inject } from '@angular/core';
import { provideMapStyles } from 'ng-mapcn';

export const appConfig: ApplicationConfig = {
  providers: [
    // Static config...
    provideMapStyles({
      light: 'https://tiles.openfreemap.org/styles/positron',
      dark: 'https://tiles.openfreemap.org/styles/dark',
    }),

    // ...or a signal, so the basemap can be switched at runtime
    provideMapStyles(() => inject(BasemapService).styles),
  ],
};
ArgumentTypeDefaultDescription
MapStylesConfig{ light?: string | StyleSpecification; dark?: string | StyleSpecification }— Per-theme basemap. A theme left undefined falls back to the Carto default for that theme.
provideMapStyles(source)MapStylesConfig | Signal<MapStylesConfig | undefined> | (() => Signal<MapStylesConfig | undefined>)— Provider for the app-wide basemap. The factory form runs in an injection context, so it can inject() a service holding the signal.
MAP_DEFAULT_STYLESInjectionToken<Signal<MapStylesConfig | undefined>>— The token itself, if you want to provide it by hand.

provideMapLabels()

#

Translates the control buttons, the loader and the popup close button through the MAP_LABELS token. Partial labels merge over the English defaults; pass a signal to follow the active locale. A labels input on ng-map, ng-map-controls and ng-map-popup overrides it per component.

import { inject } from '@angular/core';
import { provideMapLabels } from 'ng-mapcn';

export const appConfig: ApplicationConfig = {
  providers: [
    // Static (partial) labels merge over the English defaults...
    provideMapLabels({
      zoomIn: 'Aproximar',
      zoomOut: 'Afastar',
      resetNorth: 'Apontar para o norte',
      locate: 'Minha localização',
      fullscreen: 'Tela cheia',
      loading: 'Carregando mapa',
      closePopup: 'Fechar',
    }),

    // ...or a signal, so the labels follow the active locale
    provideMapLabels(() => inject(I18nService).mapLabels),
  ],
};

// Per component: <ng-map-controls [labels]="{ zoomIn: 'Acercar' }" />
ArgumentTypeDefaultDescription
MapLabels{ zoomIn; zoomOut; resetNorth; locate; fullscreen; loading; closePopup; marker: string }— Every user-facing and aria string the library renders. Defaults are English: 'Zoom in', 'Zoom out', 'Reset north', 'My location', 'Toggle fullscreen', 'Loading map', 'Close popup', 'Map marker'.
provideMapLabels(source)Partial<MapLabels> | Signal<Partial<MapLabels> | undefined> | (() => Signal<Partial<MapLabels> | undefined>)— Provider for app-wide labels; missing keys fall back to the English defaults. The factory form runs in an injection context, so it can inject() a service holding the signal.
MAP_LABELSInjectionToken<Signal<Partial<MapLabels> | undefined>>— The token itself, if you want to provide it by hand.
DEFAULT_MAP_LABELSMapLabels— The English defaults.