Getting started
Install
bash
npm install @zaes/military-symbolsThen 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/maplibreol 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 drawnsize is the height of the bounding octagon in pixels, about a land unit frame's height.
The entry points
| Entry | What it adds | Needs |
|---|---|---|
@zaes/military-symbols | renderSymbol, canvas and data URL output, the atlas, the image provider | nothing |
/2525d | 2525D's own drawings (use2525D()) | |
/2525c | 2525C letter codes (use2525C()) | |
/2525b | 2525B letter codes (use2525B()) | |
/app6b | APP-6(B) letter codes (useAPP6B()) | |
/map | the saved object, the collection and the map configuration | |
/openlayers | MilitarySymbolsOpenLayers | ol |
/maplibre | MilitarySymbolsMapLibre, flat or tilted over terrain | maplibre-gl |
/editor | placing, selecting, resizing and rotating symbols on either | |
/leaflet | icons and markers for Leaflet | Leaflet, handed in |
/arcgis | picture markers for the ArcGIS Maps SDK | the SDK, by autocast |
/picker | a searchable symbol picker for a page | a 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 codeNext
- Drawing a symbol: the options, display modes and output formats
- Amplifiers: text and graphic amplifiers by field letter
- On a map: OpenLayers, MapLibre and the editor