Skip to content

Leaflet and ArcGIS ​

Two light adapters for maps that place pictures. They draw a saved symbol (see On a map) with the same configuration as the other renderers (configureMilitarySymbols), anchored where the standard puts it, with the amplifiers measured on the ground (AH, AI, AK) as lines. They have no editor.

Leaflet ​

Leaflet is handed in, so this entry imports nothing of it; the global L works too.

ts
import * as L from 'leaflet';
import {leafletMilitarySymbols} from '@zaes/military-symbols/leaflet';

const ms = leafletMilitarySymbols(L);
ms.layer(featureCollection).addTo(map);              // every symbol, with its ground lines

const symbol = {name: '130310000012110000000000000000', amplifiers: {T: '1-66'}};
ms.marker([35.27, -116.68], symbol)?.addTo(map);     // one symbol (or just its code)
ms.icon(symbol);                                     // its L.Icon, anchored on the point
ms.groundLines([35.27, -116.68], symbol);            // its AH, AI and AK as polylines

It works with Leaflet 1.9 and 2.

ArcGIS Maps SDK for JavaScript ​

Plain objects the SDK autocasts, so nothing of @arcgis/core is imported:

ts
import Graphic from '@arcgis/core/Graphic';
import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer';
import {militaryGraphics, militaryPictureMarker} from '@zaes/military-symbols/arcgis';

const layer = new GraphicsLayer();
layer.addMany(militaryGraphics(featureCollection.features).map((g) => new Graphic(g)));

militaryPictureMarker(symbol);    // one symbol (or its code), as a picture-marker symbol

Sizes are in points, and the anchor is put on the point with the marker's offsets.

Released under the MIT License; the drawings derive from Apache-2.0 work.