@deltabreen/maps-angular
v0.6.0
Published
Angular standalone components for Maps by DeltaBreen: <deltabreen-map-view> and <deltabreen-map-marker> on our MapLibre maps, with the token handled for you. Flat plans, no overage.
Maintainers
Readme
@deltabreen/maps-angular
Angular standalone components for Maps by DeltaBreen, for Angular 17 and later: MapLibre maps on our tiles, with the key and its short-lived token handled for you. Free to start, flat plans, and never an overage bill.
npm install @deltabreen/maps-angular maplibre-glimport { Component } from '@angular/core'
import { DeltabreenMapComponent, DeltabreenMarkerComponent } from '@deltabreen/maps-angular'
@Component({
selector: 'app-store-map',
imports: [DeltabreenMapComponent, DeltabreenMarkerComponent],
template: `
<deltabreen-map-view apiKey="pk_…" workerUrl="/maplibre/maplibre-gl-worker.mjs" [center]="shop" [zoom]="12"
style="height: 480px" (load)="ready($event)">
<deltabreen-map-marker [lngLat]="shop" popup="Our shop" />
</deltabreen-map-view>`,
})
export class StoreMap {
shop: [number, number] = [-6.26, 53.35]
ready(map: unknown) {}
}In angular.json, under the build's options, add maplibre's stylesheet and copy its worker where workerUrl points:
"styles": ["node_modules/maplibre-gl/dist/maplibre-gl.css"],
"assets": [{ "glob": "maplibre-gl-{worker,shared}.mjs", "input": "node_modules/maplibre-gl/dist", "output": "maplibre" }]apiKeyis a publishable key from your dashboard, listing the sites that may use it (or givetokenUrl).- The map is made in the browser only, so server rendering needs nothing extra, and once per key; changing
mapStyle,language,centerorzoommoves the same map, so none of that counts another map load. (load)hands you the live MapLibre map;optionstakes anything elsecreateMapfrom@deltabreen/mapstakes.
Docs: https://maps.deltabreen.eu/docs#vue-svelte-angular
