Skip to content

Getting started ​

Install ​

bash
npm install @zaes/military-symbols

Then the map library you place symbols with, if any:

bash
npm install ol            # for @zaes/military-symbols/openlayers
npm install maplibre-gl   # for @zaes/military-symbols/maplibre

ol and maplibre-gl are optional peers. Leaflet and the ArcGIS SDK are handed in, never imported (see Leaflet and ArcGIS).

A symbol without a map ​

ts
import {renderSymbol} from '@zaes/military-symbols';

const r = renderSymbol('130310000012110000000000000000', {size: 50, amplifiers: {T: '1-66', M: '2BCT'}});

r.svg;       // a complete <svg> element
r.width;     // its size in pixels
r.anchor;    // where it sits on the map: the octagon's centre, or a headquarters staff's foot
r.problems;  // anything the code asked for that could not be drawn

size is the height of the bounding octagon in pixels, about a land unit frame's height.

The entry points ​

EntryWhat it addsNeeds
@zaes/military-symbolsrenderSymbol, canvas and data URL output, the atlas, the image providernothing
/2525d2525D's own drawings (use2525D())
/2525c2525C letter codes (use2525C())
/2525b2525B letter codes (use2525B())
/app6bAPP-6(B) letter codes (useAPP6B())
/mapthe saved object, the collection and the map configuration
/openlayersMilitarySymbolsOpenLayersol
/maplibreMilitarySymbolsMapLibre, flat or tilted over terrainmaplibre-gl
/editorplacing, selecting, resizing and rotating symbols on either
/leafleticons and markers for LeafletLeaflet, handed in
/arcgispicture markers for the ArcGIS Maps SDKthe SDK, by autocast
/pickera searchable symbol picker for a pagea page

A host that only wants 2525E pictures loads the root alone and pays for nothing else. The other standards are loaded once, when wanted:

ts
import {use2525C} from '@zaes/military-symbols/2525c';

use2525C();                          // also loads 2525D, which 2525C codes convert to
renderSymbol('SFGPUCI----E---');     // a 2525C letter code

Next ​

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