### Draw Friendly Ground Installation Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws a friendly ground installation symbol using the APP6-B standard with a specified size. This example is for rendering installation symbols. ```javascript document.write(new ms.Symbol("SFG-I-----H-", { size: 40 }).asSVG()); ``` -------------------------------- ### Draw Unknown Ground Installation Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws an unknown ground installation symbol using the APP6-B standard with a specified size. This example is for rendering unknown installation symbols. ```javascript document.write(new ms.Symbol("SUG-I-----H-", { size: 40 }).asSVG()); ``` -------------------------------- ### Install Milsymbol via npm Source: https://context7.com/spatialillusions/milsymbol/llms.txt Use npm to install the Milsymbol library for your project. ```bash npm install milsymbol ``` -------------------------------- ### Draw Pending Ground Installation Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws a pending ground installation symbol using the APP6-B standard with a specified size. This example is for rendering pending installation symbols. ```javascript document.write(new ms.Symbol("SPG-I-----H-", { size: 40 }).asSVG()); ``` -------------------------------- ### Draw Neutral Ground Installation Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws a neutral ground installation symbol using the APP6-B standard with a specified size. This example is for rendering neutral installation symbols. ```javascript document.write(new ms.Symbol("SNG-I-----H-", { size: 40 }).asSVG()); ``` -------------------------------- ### Draw Hostile Ground Installation Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws a hostile ground installation symbol using the APP6-B standard with a specified size. This example is for rendering hostile installation symbols. ```javascript document.write(new ms.Symbol("SHG-I-----H-", { size: 40 }).asSVG()); ``` -------------------------------- ### Draw Suspect Ground Installation Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws a suspect ground installation symbol using the APP6-B standard with a specified size. This example is for rendering suspect installation symbols. ```javascript document.write(new ms.Symbol("SSG-I-----H-", { size: 40 }).asSVG()); ``` -------------------------------- ### Draw Assumed Friend Ground Installation Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws an assumed friend ground installation symbol using the APP6-B standard with a specified size. This example is for rendering assumed friend installation symbols. ```javascript document.write(new ms.Symbol("SAG-I-----H-", { size: 40 }).asSVG()); ``` -------------------------------- ### Initialize Leaflet Map and Add Tile Layer Source: https://github.com/spatialillusions/milsymbol/blob/master/examples/leaflet-divicons/index.html Sets up a basic Leaflet map with OpenStreetMap tiles. This is a common starting point for most Leaflet applications. ```javascript function init() { var osmAttr = '© OpenStreetMap contributors, CC-BY-SA'; var OSM = L.tileLayer( "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { maxZoom: 18, attribution: osmAttr } ); var latlng = L.latLng(59, 16); var map = L.map("map", { center: latlng, zoom: 5, layers: [OSM] }); ``` -------------------------------- ### Import Milsymbol and Add Icons (ES6) Source: https://github.com/spatialillusions/milsymbol/blob/master/examples/es6-import/index.html Import necessary modules from Milsymbol and add standard 2525c icons. This setup is required before creating symbols. ```javascript import { ms, std2525c } from '../../index.esm.js'; ms.addIcons(std2525c); ``` -------------------------------- ### Generate Land Installation Symbol - Full to Capacity Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Generates an SVG for a Land Installation symbol with the 'Full to Capacity' operational condition. Ensure 'standardEdition' is defined. ```javascript document.write( new ms.Symbol(standardEdition + "03305", { size: 40 }).asSVG() ); ``` -------------------------------- ### Render Full to Capacity Symbol (Ground Installations) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525c.html Generates an SVG for a ground installation tactical symbol with a 'Full to Capacity' static operational condition modifier. Verify the symbol code for ground installations. ```javascript document.write( new ms.Symbol("SFGFIRP---H-", { size: 40, monoColor: "black" }).asSVG() ); ``` -------------------------------- ### Get Version Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md Retrieves the current version string of the Milsymbol library. ```javascript String; ``` -------------------------------- ### Render Fully Capable Symbol (Ground Installations) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525c.html Generates an SVG for a ground installation tactical symbol with a 'Fully Capable' static operational condition modifier. Verify the symbol code for ground installations. ```javascript document.write( new ms.Symbol("SFGCIRP---H-", { size: 40, monoColor: "black" }).asSVG() ); ``` -------------------------------- ### Initialize D3 SVG Canvas Source: https://github.com/spatialillusions/milsymbol/blob/master/examples/d3-list/index.html Sets up the SVG canvas and margins for D3 visualizations. This is a common starting point for D3 projects. ```javascript var duration = 300; var margin = { top: 15, right: 20, bottom: 10, left: 30 }; var svg = d3 .select("#orbat") .append("svg") .attr("width", 500) .attr("height", 500) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); ``` -------------------------------- ### Create Land Installation Symbol - MS2525E Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Creates an SVG representation of a Land Installation symbol using the MS2525E standard. Various amplifier fields can be set using the options object. ```javascript document.write( new ms.Symbol( standardEdition + "032051000000000000", { //quantity: 'C', //reinforcedReduced: 'F', staffComments: "G", additionalInformation: "H", evaluationRating: "J", combatEffectiveness: "K", higherFormation: "M", //iffSif: 'P', //direction: 45, uniqueDesignation: "T", //type: 'V', dtg: "W", altitudeDepth: "X", location: "Y", //speed: 'Z', //specialHeadquarters: 'AA', country: "AC", //platformType: 'AD', equipmentTeardownTime: "AE", //commonIdentifier: 'AF', //headquartersElement: 'AH', installationComposition: "AI" //engagementBar: 'AO' }, { size: 100 } ).asSVG() ); ``` -------------------------------- ### Generate SVG Symbol for Land Installation (Friend) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates an SVG representation of a land installation symbol, categorized under 'Friend'. The symbol is configured with a size of 40. ```javascript document.write(new ms.Symbol(100320, { size: 40 }).asSVG()); ``` -------------------------------- ### Generate Fully Capable Land Installation Symbol with Simple Status Modifier (SVG) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Generates an SVG for a fully capable land installation symbol, forcing standard operational condition amplifiers. Use when simpleStatusModifier option is true. ```javascript document.write( new ms.Symbol(standardEdition + "03302", { size: 40, simpleStatusModifier: true }).asSVG() ); ``` -------------------------------- ### Generate Space Symbol with Amplifiers Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates a space APP6d symbol with amplifier fields. This example shows how to set specific attributes for space-based military assets. ```javascript document.write( new ms.Symbol( standardEdition + "030550000000000000", { //quantity: 'C', //reinforcedReduced: 'F', staffComments: "G", //additionalInformation: 'H', //evaluationRating: 'J', //combatEffectiveness: 'K', //higherFormation: 'M', //iffSif: 'P', //direction: 45, uniqueDesignation: "T", type: "V", //dtg: 'W', altitudeDepth: "X", //speed: 'Z', //specialHeadquarters: 'AA', //platformType: 'AD', //equipmentTeardownTime: 'AE', //commonIdentifier: 'AF', //headquartersElement: 'AH', engagementBar: "AO", direction: 290, speedLeader: 150, }, { size: 100 } ).asSVG() ); ``` -------------------------------- ### Create and Render SVG/Canvas Symbol (ES6) Source: https://github.com/spatialillusions/milsymbol/blob/master/examples/es6-import/index.html Creates a Milsymbol instance with specified properties and renders it as both an SVG element and a Canvas element. This example assumes icons have been added. ```javascript var color = "yellow"; var outline = 3; var symbol = new ms.Symbol("sfgpewrh--mt", { size: 35, quantity: 200, staffComments: "for reinforcements".toUpperCase(), additionalInformation: "added support for JJ".toUpperCase(), direction: (750 * 360 / 6400), type: "machine gun".toUpperCase(), dtg: "30140000ZSEP97", location: "0900000.0E570306.0N", outlineColor: color, outlineWidth: outline }); document.getElementById("SVG-imported").innerHTML = symbol.asSVG(); document.getElementById("Canvas-imported").replaceChild( symbol.asCanvas(), document.getElementById("Canvas-imported").firstChild); ``` -------------------------------- ### Generate Sea Subsurface Symbol with Amplifiers Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates a sea subsurface APP6d symbol with amplifier fields. This example demonstrates setting various optional parameters for detailed symbol representation. ```javascript document.write( new ms.Symbol( standardEdition + "033550000000000000", { //quantity: 'C', //reinforcedReduced: 'F', staffComments: "G", additionalInformation: "H", //evaluationRating: 'J', //combatEffectiveness: 'K', //signatureEquipment: 'L', //higherFormation: 'M', //hostile: 'N', iffSif: "P", //direction: 45, uniqueDesignation: "T", type: "V", //dtg: 'W', altitudeDepth: "X", location: "Y", speed: "Z", //specialHeadquarters: 'AA', //country: 'AC', //platformType: 'AD', //equipmentTeardownTime: 'AE', //commonIdentifier: 'AF', //headquartersElement: 'AH', engagementBar: "AO", guardedUnit: "AQ", specialDesignator: "AR", direction: 240, speedLeader: 150, }, { size: 100 } ).asSVG() ); ``` -------------------------------- ### Draw Friendly Space Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws a friendly space symbol using the APP6-B standard with a specified size. This is an example of generating a symbol dynamically. ```javascript document.write(new ms.Symbol("SFP---------", { size: 40 }).asSVG()); ``` -------------------------------- ### Generate Alternative Main Icon Symbol Sizes (APP6d) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Demonstrates generating symbols with different sizes, specifically showing alternative main icon symbol sizes. The size parameter controls the output dimensions. ```javascript document.write( new ms.Symbol(standardEdition + "032700001103010527", { size: 80, }).asSVG() ); ``` ```javascript document.write( new ms.Symbol(standardEdition + "032700001103010000", { size: 80, }).asSVG() ); ``` ```javascript document.write( new ms.Symbol(standardEdition + "032700001103010027", { size: 80, }).asSVG() ); ``` ```javascript document.write( new ms.Symbol(standardEdition + "032700001103010500", { size: 80, }).asSVG() ); ``` -------------------------------- ### Draw Unknown Subsurface Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws an unknown subsurface symbol using the APP6-B standard with a specified size. This example is for rendering unknown subsurface symbols. ```javascript document.write(new ms.Symbol("SUU---------", { size: 40 }).asSVG()); ``` -------------------------------- ### Initialize Symbol with SIDC and Options Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md Initiates a new symbol object with a specified SIDC and an options object. Providing options at initialization is more performant than updating them later. ```javascript var symbol = new ms.Symbol("SFG-UCI----D", { size: 30 }); ``` -------------------------------- ### Display Text Fields with Milsymbol SVG Source: https://github.com/spatialillusions/milsymbol/blob/master/examples/speed-svg/index.html This example demonstrates how to display text fields using Milsymbol SVG. It involves defining symbol SIDC codes and a size variable for rendering. ```javascript var size = 40; var symbolsSIDC = ["SUP*------***", "SFP*------***", "SNP*------***", "SHP*------***", "SUP*S-----", "SFP*S-----", "SNP*S-----", "SHP*S-----", "SUP*V-----", "SFP*V-----", "SNP*V-----", "SHP*V-----", "SUP*T-----", "SFP*T-----", "SNP*T-----", "SHP*T-----", "SUP*L-----", "SFP*L-----", "SNP*L-----", "SHP*L-----", "SUA*------***", "SFA*------***", "SNA*------***", "SHA*------***", "SUA*M-----", "SFA*M-----", "SNA*M-----", "SHA*M-----", "SUA*MF----", "SFA*MF----", "SNA*MF----", "SHA*MF----", "SUA*MFB---", "SFA*MFB---", "SNA*MFB---", "SHA*MFB---", "SUA*MFF---", "SFA*MFF---", "SNA*MFF---", "SHA*MFF---", "SUA*MFFI--", "SFA*MFFI--", "SNA*MFFI--", "SHA*MFFI--", "SUA*MFT---", "SFA*MFT---", "SNA*MFT---", "SHA*MFT---", "SUA*MFA---", "SFA*MFA---", "SNA*MFA---", "SHA*MFA---", "SUA*MFL---", "SFA*MFL---", "SNA*MFL---", "SHA*MFL---", "SUA*MFK---", "SFA*MFK---", "SNA*MFK---", "SHA*MFK---", "SUA*MFKB--", "SFA*MFKB--", "SNA*MFKB--", "SHA*MFKB--", "SUA*MFKD--", "SFA*MFKD--", "SNA*MFKD--", "SHA*MFKD--", "SUA*MFC---", "SFA*MFC---", "SNA*MFC---", "SHA*MFC---", "SUA*MFCL--", "SFA*MFCL--", "SNA*MFCL--", "SHA*MFCL--", "SUA*MFCM--", "SFA*MFCM--", "SNA*MFCM--", "SHA*MFCM--", "SUA*MFCH--", "SFA*MFCH--", "SNA*MFCH--", "SHA*MFCH--", "SUA*MFJ---", "SFA*MFJ---", "SNA*MFJ---", "SHA*MFJ---", "SUA*MFO---", "SFA*MFO---", "SNA*MFO---", "SHA*MFO---", "SUA*MFR---", "SFA*MFR---", "SNA*MFR---", "SHA*MFR---", "SUA*MFRW--", "SFA*MFRW--", "SNA*MFRW--", "SHA*MFRW--", "SUA*MFRZ--", "SFA*MFRZ--", "SNA*MFRZ--", "SHA*MFRZ--", "SUA*MFRX--", "SFA*MFRX--", "SNA*MFRX--", "SHA*MFRX--", "SUA*MFP---", "SFA*MFP---", "SNA*MFP---", "SHA*MFP---", "SUA*MFPN--", "SFA*MFPN--", "SNA*MFPN--", "SHA*MFPN--", "SUA*MFPM--", "SFA*MFPM--", "SNA*MFPM--", "SHA*MFPM--", "SUA*MFU---", "SFA*MFU---", "SNA*MFU---", "SHA*MFU---", "SUA*MFUL--", "SFA*MFUL--", "SNA*MFUL--", "SHA*MFUL--", "SUA*MFUM--", "SFA*MFUM--", "SNA*MFUM--", "SHA*MFUM--", "SUA*MFUH--", "SFA*MFUH--", "SNA*MFUH--", "SHA*MFUH--", "SUA*MFY---", "SFA*MFY---", "SNA*MFY---", "SHA*MFY---", "SUA*MFH---", "SFA*MFH---", "SNA*MFH---", "SHA*MFH---", "SUA*MFD---", "SFA*MFD---", "SNA*MFD---", "SHA*MFD---", "SUA*MFQ---", "SFA*MFQ---", "SNA*MFQ---", "SHA*MFQ---", "SUA*MFQA--", "SFA*MFQA--", "SNA*MFQA--", "SHA*MFQA--", "SUA*MFQB--", "SFA*MFQB--", "SNA*MFQB--", "SHA*MFQB--", "SUA*MFQC--", "SFA*MFQC--", "SNA*MFQC--", "SHA*MFQC--", "SUA*MFQD--", "SFA*MFQD--", "SNA*MFQD--", "SHA*MFQD--", "SUA*MFQF--", "SFA*MFQF--", "SNA*MFQF--", "SHA*MFQF--", "SUA*MFQH--", "SFA*MFQH--", "SNA*MFQH--", "SHA*MFQH--", "SUA*MFQJ--", "SFA*MFQJ--", "SNA*MFQJ--", "SHA*MFQJ--", "SUA*MFQK--", "SFA*MFQK--", "SNA*MFQK--", "SHA*MFQK--", "SUA*MFQL--", "SFA*MFQL--", "SNA*MFQL--", "SHA*MFQL--", "SUA*MFQM--", "SFA*MFQM--", "SNA*MFQM--", "SHA*MFQM--", "SUA*MFQI--", "SFA*MFQI--", "SNA*MFQI--", "SHA*MFQI--", "SUA*MFQN-"]; ``` -------------------------------- ### Vanilla Browser Usage Source: https://context7.com/spatialillusions/milsymbol/llms.txt Include the prebuilt bundle in your HTML to use Milsymbol globally in the browser. ```html ``` -------------------------------- ### Display Text Fields with MilSymbol on Canvas Source: https://github.com/spatialillusions/milsymbol/blob/master/examples/speed-canvas/index.html This example shows how to render MilSymbol icons with text fields on a canvas. It initializes a size variable and defines an array of symbols SIDC codes to be rendered. This approach is useful for scenarios where performance is critical, such as displaying many symbols simultaneously. ```javascript var size = 40; var symbolsSIDC = ['SUP*------**', 'SFP*------**', 'SNP*------**', 'SHP*------**', 'SUP*S-----**', 'SFP*S-----**', 'SNP*S-----**', 'SHP*S-----**', 'SUP*V-----**', 'SFP*V-----**', 'SNP*V-----**', 'SHP*V-----**', 'SUP*T-----**', 'SFP*T-----**', 'SNP*T-----**', 'SHP*T-----**', 'SUP*L-----**', 'SFP*L-----**', 'SNP*L-----**', 'SHP*L-----**', 'SUA*------**', 'SFA*------**', 'SNA*------**', 'SHA*------**', 'SUA*M-----**', 'SFA*M-----**', 'SNA*M-----**', 'SHA*M-----**', 'SUA*MF----**', 'SFA*MF----**', 'SNA*MF----**', 'SHA*MF----**', 'SUA*MFB---**', 'SFA*MFB---**', 'SNA*MFB---**', 'SHA*MFB---**', 'SUA*MFF---**', 'SFA*MFF---**', 'SNA*MFF---**', 'SHA*MFF---**', 'SUA*MFFI--**', 'SFA*MFFI--**', 'SNA*MFFI--**', 'SHA*MFFI--**', 'SUA*MFT---**', 'SFA*MFT---**', 'SNA*MFT---**', 'SHA*MFT---**', 'SUA*MFA---**', 'SFA*MFA---**', 'SNA*MFA---**', 'SHA*MFA---**', 'SUA*MFL---**', 'SFA*MFL---**', 'SNA*MFL---**', 'SHA*MFL---**', 'SUA*MFK---**', 'SFA*MFK---**', 'SNA*MFK---**', 'SHA*MFK---**', 'SUA*MFKB--**', 'SFA*MFKB--**', 'SNA*MFKB--**', 'SHA*MFKB--**', 'SUA*MFKD--**', 'SFA*MFKD--**', 'SNA*MFKD--**', 'SHA*MFKD--**', 'SUA*MFC---**', 'SFA*MFC---**', 'SNA*MFC---**', 'SHA*MFC---**', 'SUA*MFCL--**', 'SFA*MFCL--**', 'SNA*MFCL--**', 'SHA*MFCL--**', 'SUA*MFCM--**', 'SFA*MFCM--**', 'SNA*MFCM--**', 'SHA*MFCM--**', 'SUA*MFCH--**', 'SFA*MFCH--**', 'SNA*MFCH--**', 'SHA*MFCH--**', 'SUA*MFJ---**', 'SFA*MFJ---**', 'SNA*MFJ---**', 'SHA*MFJ---**', 'SUA*MFO---**', 'SFA*MFO---**', 'SNA*MFO---**', 'SHA*MFO---**', 'SUA*MFR---**', 'SFA*MFR---**', 'SNA*MFR---**', 'SHA*MFR---**', 'SUA*MFRW--**', 'SFA*MFRW--**', 'SNA*MFRW--**', 'SHA*MFRW--**', 'SUA*MFRZ--**', 'SFA*MFRZ--**', 'SNA*MFRZ--**', 'SHA*MFRZ--**', 'SUA*MFRX--**', 'SFA*MFRX--**', 'SNA*MFRX--**', 'SHA*MFRX--**', 'SUA*MFP---**', 'SFA*MFP---**', 'SNA*MFP---**', 'SHA*MFP---**', 'SUA*MFPN--**', 'SFA*MFPN--**', 'SNA*MFPN--**', 'SHA*MFPN--**', 'SUA*MFPM--**', 'SFA*MFPM--**', 'SNA*MFPM--**', 'SHA*MFPM--**', 'SUA*MFU---**', 'SFA*MFU---**', 'SNA*MFU---**', 'SHA*MFU---**', 'SUA*MFUL--**', 'SFA*MFUL--**', 'SNA*MFUL--**', 'SHA*MFUL--**', 'SUA*MFUM--**', 'SFA*MFUM--**', 'SNA*MFUM--**', 'SHA*MFUM--**', 'SUA*MFUH--**', 'SFA*MFUH--**', 'SNA*MFUH--**', 'SHA*MFUH--**', 'SUA*MFY---**', 'SFA*MFY---**', 'SNA*MFY---**', 'SHA*MFY---**', 'SUA*MFH---**', 'SFA*MFH---**', 'SNA*MFH---**', 'SHA*MFH---**', 'SUA*MFD---**', 'SFA*MFD---**', 'SNA*MFD---**', 'SHA*MFD---**', 'SUA*MFQ---**', 'SFA*MFQ---**', 'SNA*MFQ---**', 'SHA*MFQ---**', 'SUA*MFQA--**', 'SFA*MFQA--**', 'SNA*MFQA--**', 'SHA*MFQA--**', 'SUA*MFQB--**', 'SFA*MFQB--**', 'SNA*MFQB--**', 'SHA*MFQB--**', 'SUA*MFQC--**', 'SFA*MFQC--**', 'SNA*MFQC--**', 'SHA*MFQC--**', 'SUA*MFQD--**', 'SFA*MFQD--**', 'SNA*MFQD--**', 'SHA*MFQD--**', 'SUA*MFQF--**', 'SFA*MFQF--**', 'SNA*MFQF--**', 'SHA*MFQF--**', 'SUA*MFQH--**', 'SFA*MFQH--**', 'SNA*MFQH--**', 'SHA*MFQH--**', 'SUA*MFQJ--**', 'SFA*MFQJ--**', 'SNA*MFQJ--**', 'SHA*MFQJ--**', 'SUA*MFQK--**', 'SFA*MFQK--**', 'SNA*MFQK--**', 'SHA*MFQK--**', 'SUA*MFQL--**', 'SFA*MFQL--**', 'SNA*MFQL--**', 'SHA*MFQL--**', 'SUA*MFQM--**', 'SFA*MFQM--**', 'SNA*MFQM--**', 'SHA*MFQM--**', 'SUA*MFQI--**', 'SFA*MFQI--**', 'SNA*MFQI--**', 'SHA*MFQI--**', 'SUA*MFQN-' ] ``` -------------------------------- ### Draw Unknown Ground Unit Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws an unknown ground unit symbol using the APP6-B standard with a specified size. This example is for rendering unknown ground unit symbols. ```javascript document.write(new ms.Symbol("SUG-U-------", { size: 40 }).asSVG()); ``` -------------------------------- ### Initialize ArcGIS Map and SceneView Source: https://github.com/spatialillusions/milsymbol/blob/master/examples/arcgis3d/index.html Sets up the basic ArcGIS map and scene view. Ensure the 'viewDiv' element exists in your HTML. ```javascript html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } require([ "esri/Map", "esri/views/SceneView", "esri/layers/FeatureLayer", "esri/layers/support/Field", "esri/renderers/UniqueValueRenderer", "esri/geometry/Point", "esri/symbols/PointSymbol3D", "esri/symbols/IconSymbol3DLayer", "milsymbol", "dojo/_base/array", "dojo/on", "dojo/dom", "dojo/domReady!" ], function ( Map, SceneView, FeatureLayer, Field, UniqueValueRenderer, Point, PointSymbol3D, IconSymbol3DLayer, ms, arrayUtils, on, dom ) { var map = new Map({ basemap: "dark-gray", ground: "world-elevation" }); var view = new SceneView({ container: "viewDiv", map: map, camera: { position: { x: 16, // lon y: 45, // lat z: 1500000 // elevation in meters }, //scale: 15000000, //center: [16, 60], tilt: 45 } }); ``` -------------------------------- ### Draw Friendly Ground Unit Symbol (APP6-B) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6b.html Draws a friendly ground unit symbol using the APP6-B standard with a specified size. This example shows how to render ground unit symbols. ```javascript document.write(new ms.Symbol("SFG-U-------", { size: 40 }).asSVG()); ``` -------------------------------- ### Render Destroyed Symbol (Ground Installations) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525c.html Generates an SVG for a ground installation tactical symbol with a 'Destroyed' static operational condition modifier. Verify the symbol code for ground installations. ```javascript document.write( new ms.Symbol("SFGXIRP---H-", { size: 40, monoColor: "black" }).asSVG() ); ``` -------------------------------- ### Render Damaged Symbol (Ground Installations) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525c.html Generates an SVG for a ground installation tactical symbol with a 'Damaged' static operational condition modifier. Verify the symbol code for ground installations. ```javascript document.write( new ms.Symbol("SFGDIRP---H-", { size: 40, monoColor: "black" }).asSVG() ); ``` -------------------------------- ### Generate SVG Symbol for Land Installation Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates an SVG representation of a land installation symbol. The symbol is configured with a size of 40. ```javascript document.write(new ms.Symbol(100020, { size: 40 }).asSVG()); ``` -------------------------------- ### Create a Symbol with Options Source: https://github.com/spatialillusions/milsymbol/blob/master/README.md Instantiate a symbol with specific options like size, quantity, and text information. The output can be rendered as an SVG element. ```javascript new ms.Symbol("130315003611010300000000000000", { size: 35, quantity: 200, staffComments: "for reinforcements".toUpperCase(), additionalInformation: "added support for JJ".toUpperCase(), direction: (750 * 360) / 6400, type: "machine gun".toUpperCase(), dtg: "30140000ZSEP97", location: "0900000.0E570306.0N", }).asSVG(); ``` -------------------------------- ### Generate Land Installation Symbol - Destroyed Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Generates an SVG for a Land Installation symbol with the 'Destroyed' operational condition. Ensure 'standardEdition' is defined. ```javascript document.write( new ms.Symbol(standardEdition + "03304", { size: 40 }).asSVG() ); ``` -------------------------------- ### ms.Symbol Constructor Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md Initializes a new Milsymbol object with various configuration options. ```APIDOC ## ms.Symbol(_arg1, arg2 ... argN_) ### Description Initializes a new Milsymbol object. ### Parameters #### Options - **size** (Number) - Optional - The L value for your symbol, where the L value is the width of the icon octagon. Defaults to 100. - **simpleStatusModifier** (Boolean) - Optional - Should the symbol use simplified status modifiers. Defaults to false. - **standard** (String) - Optional - Override the default standard set for milsymbol. Can be set to "2525" or "APP6". Defaults to an empty string. - **square** (Boolean) - Optional - Should the symbol be square with the insertion point in the center. Defaults to false. - **stack** (Number) - Optional - Should the symbol be displayed as a stack of units. The number indicates the additional units that should be displayed behind the original symbol. Defaults to 0. - **strokeWidth** (Number) - Optional - The stroke width of the symbol. Defaults to 3. ### Returns - **Object** - The initialized Milsymbol object. ``` -------------------------------- ### Generate SVG Symbol for Land Installation Icon Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates an SVG representation of a Land Installation icon symbol with a specific ID and size. ```javascript document.write(new ms.Symbol(1003302, { size: 40 }).asSVG()); ``` -------------------------------- ### ms.Symbol Constructor Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md Initiates a new symbol object. You can provide options directly during initialization for better performance. Arguments can be SIDC string or options objects. ```APIDOC ## ms.Symbol(_arg1, arg2 ... argN_) ### Description Initiates a new symbol object, where arg1-argN are options objects. If you provide an argument that isn't an object, we will assume that it is the SIDC for the symbol. Even if options can be provided or updated after the symbol object is created, the performance will be better if you provide them directly when you create the symbol, or to provide no arguments at all, this is because every time you update some options the symbol will automatically be updated. ### Method Constructor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript var symbol = new ms.Symbol("SFG-UCI----D", { size: 30 }); var symbolChained = new ms.Symbol("SFG-UCI----D", { size: 30 }).asSVG(); ``` ### Response #### Success Response (200) Symbol object #### Response Example None ### General Options It is possible to add any custom options to your options object as well as the options listed below. | Option | Type | Default | Description | | ------ | ------ | ------- | ----------------------- | | sidc | String | '' | The SIDC for the symbol | ### Modifier Options The following options are modifiers, text or graphical, that are defined in the standard documents. | Option | Type | Default | Description | | ------ | ------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | additionalInformation | String | '' | A text modifier for units, equipment, and installations; content is implementation specific.
**Field H** _20 Characters_ | | altitudeDepth | String | '' | A text modifier for units, equipment, and installations, that displays either altitude flight level, depth for submerged objects; or height of equipment or structures on the ground.
**Field X** _14 Characters_ | | combatEffectiveness | String | '' | A text modifier for units and installations that indicates unit effectiveness or installation capability.
**Field K** _5 Characters_ | | commonIdentifier | String | '' | Example: "Hawk" for Hawk SAM system.
**Field AF** | | country | String | '' | Three letter representing the country.
**Field AC** | | direction | Number | undefined | At the moment all directions should be in degrees and not in mils. Set to an undefined to remove the direction arrow.
**Field Q** | | dtg | String | '' | A text modifier for units, equipment, and installations that displays DTG format: DDHHMMSSZMONYYYY or "O/O" for on order.
**Field W** _16 Characters_ | | engagementBar | String | '' | Engagement bar text, shall be arranged as follows: A:BBB-CC.
**Field AO** | | engagementType | String | '' | Engagement bar type, should be one of the following "TARGET", "NON-TARGET", or "EXPIRED" | | equipmentTeardownTime | String | '' | Equipment teardown time in minutes.
**Field AE** | ``` -------------------------------- ### Generate Hostile Symbol (Land Installation) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Generates an SVG symbol for a hostile entity in the Land Installation category. Ensure the 'standardEdition' variable is defined. ```javascript document.write( new ms.Symbol(standardEdition + "0615", { size: 40 }).asSVG() ); ``` -------------------------------- ### Generate Neutral Symbol (Land Installation) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Generates an SVG symbol for a neutral entity in the Land Installation category. Ensure the 'standardEdition' variable is defined. ```javascript document.write( new ms.Symbol(standardEdition + "0415", { size: 40 }).asSVG() ); ``` -------------------------------- ### ms.BBox({box}) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md Creates a bounding box object with optional initial values. If no object or values are provided, defaults are set to 100. ```APIDOC ## ms.BBox({box}) ```javascript Object { x1: Number, // Left coordinate {Optional} y1: Number, // Top coordinate {Optional} x2: Number, // Right coordinate {Optional} y2: Number, // Bottom coordinate {Optional} } ``` Creates a bounding box Object. It is initiated with an optional object. Values that are omitted will default to 100, and if an object isn't provided all values will default to 100. **Returns** ```javascript Object { x1: Number, // Left coordinate y1: Number, // Top coordinate x2: Number, // Right coordinate y2: Number, // Bottom coordinate width: Function, // Returns box width height: Function, // Returns box height merge(box): Function // Merges one box with another and returns the original box } ``` ``` -------------------------------- ### Generate Friend Symbol (Land Installation) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Generates an SVG symbol for a friendly entity in the Land Installation category. Ensure the 'standardEdition' variable is defined. ```javascript document.write( new ms.Symbol(standardEdition + "0315", { size: 40 }).asSVG() ); ``` -------------------------------- ### Initialize Milsymbol with Dojo Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md Load Milsymbol within a Dojo application using its AMD loader. This allows for asynchronous module loading and integration with Dojo's ecosystem. ```html ``` -------------------------------- ### Generate Unknown Symbol (Land Installation) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Generates an SVG symbol for an unknown entity in the Land Installation category. Ensure the 'standardEdition' variable is defined. ```javascript document.write( new ms.Symbol(standardEdition + "0015", { size: 40 }).asSVG() ); ``` -------------------------------- ### Initialize Symbol and Render as SVG Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md Chains the `asSVG()` method directly to symbol initialization for immediate SVG rendering. This is an alternative to initializing and then calling rendering methods. ```javascript var symbol = new ms.Symbol("SFG-UCI----D", { size: 30 }).asSVG(); ``` -------------------------------- ### Generate Land Installation Symbol - Damaged/Rendered Ineffective Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Generates an SVG for a Land Installation symbol with the 'Damaged/Rendered Ineffective' operational condition. Ensure 'standardEdition' is defined. ```javascript document.write( new ms.Symbol(standardEdition + "03303", { size: 40 }).asSVG() ); ``` -------------------------------- ### Initialize Leaflet Map and Add Milsymbol Icons Source: https://github.com/spatialillusions/milsymbol/blob/master/examples/leaflet-imageicons/index.html Sets up a basic Leaflet map with OpenStreetMap tiles and adds custom markers using milsymbol. Icon sizes are dynamically set based on the symbol's echelon. ```javascript function init() { var osmAttr = '© OpenStreetMap contributors, CC-BY-SA'; var OSM = L.tileLayer( "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { maxZoom: 18, attribution: osmAttr } ), latlng = L.latLng(59, 16); var map = L.map("map", { center: latlng, zoom: 5, layers: [OSM] }); var iconSize = { "Team/Crew": 5, Squad: 10, Section: 15, "Platoon/detachment": 20, "Company/battery/troop": 25, "Battalion/squadron": 30, "Regiment/group": 35, Brigade: 40, Division: 45, "Corps/MEF": 50, Army: 55, "Army Group/front": 60, "Region/Theater": 65, Command: 70 }; L.geoJson(situation, { pointToLayer: function(feature, latlng) { var mysymbol = new ms.Symbol(feature.properties.SIDC, { uniqueDesignation: feature.properties.name }); // Now that we have a symbol we can ask for the echelon and set the symbol size mysymbol = mysymbol.setOptions({ size: iconSize[mysymbol.getMetadata().echelon] }); var myicon = L.icon({ iconUrl: mysymbol.toDataURL(), iconAnchor: [mysymbol.getAnchor().x, mysymbol.getAnchor().y] }); return L.marker(latlng, { icon: myicon, draggable: true }); } }).addTo(map); } ``` -------------------------------- ### Generate Land Installation Symbol with Operational Condition Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Generates an SVG for a Land Installation symbol with a 'Fully Capable' operational condition. Ensure 'standardEdition' is defined. ```javascript document.write( new ms.Symbol(standardEdition + "03302", { size: 40 }).asSVG() ); ``` -------------------------------- ### Build Milsymbol Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md Run this command to build the minified version of Milsymbol using Rollup. The output will be placed in the /dist directory. ```bash npm run build ``` -------------------------------- ### Generate SVG Symbol for Destroyed Land Installation Icon Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates an SVG representation of a destroyed Land Installation icon symbol with a specific ID and size. ```javascript document.write(new ms.Symbol(1003304, { size: 40 }).asSVG()); ``` -------------------------------- ### Generate SVG Symbol for Damaged Land Installation Icon Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates an SVG representation of a damaged Land Installation icon symbol with a specific ID and size. ```javascript document.write(new ms.Symbol(1003303, { size: 40 }).asSVG()); ``` -------------------------------- ### Build Development Version of Milsymbol Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md Execute this command to build an un-minified version of Milsymbol, useful for development and debugging purposes. ```bash npm run build-dev ``` -------------------------------- ### Generate SVG Symbol for Land Installation (Suspect) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates an SVG representation of a land installation symbol, categorized under 'Suspect'. The symbol is configured with a size of 40. ```javascript document.write(new ms.Symbol(100520, { size: 40 }).asSVG()); ``` -------------------------------- ### Generate SVG Symbol for Land Installation (Hostile) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates an SVG representation of a land installation symbol, categorized under 'Hostile'. The symbol is configured with a size of 40. ```javascript document.write(new ms.Symbol(100620, { size: 40 }).asSVG()); ``` -------------------------------- ### Run Milsymbol Tests Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md Execute this command to run the test suite for Milsymbol, located in the /test directory. This helps ensure the integrity of your changes. ```bash npm run test ``` -------------------------------- ### ms.getVersion() Source: https://context7.com/spatialillusions/milsymbol/llms.txt Retrieves the current version of the MilSymbol library. ```APIDOC ## `ms.getVersion()` — Library version ```javascript import ms from "milsymbol"; console.log(ms.getVersion()); // e.g. "3.0.4" ``` ``` -------------------------------- ### Generate SVG Symbol for Land Installation (Neutral) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates an SVG representation of a land installation symbol, categorized under 'Neutral'. The symbol is configured with a size of 40. ```javascript document.write(new ms.Symbol(100420, { size: 40 }).asSVG()); ``` -------------------------------- ### Create a Basic Symbol Source: https://github.com/spatialillusions/milsymbol/blob/master/README.md Create a symbol object using its SIDC code. This object holds symbol information and draw instructions. ```javascript var sym = new ms.Symbol("130310001412110000000000000000"); ``` -------------------------------- ### Generate Basic APP6d Symbol Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates a basic APP6d symbol using the Symbol constructor and renders it as an SVG. Requires a standard edition string. ```javascript document.write( new ms.Symbol(standardEdition + "032700710000000000", { size: size, }).asSVG() ); ``` -------------------------------- ### Generate SVG Symbol for Land Installation (Unknown) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-APP6d.html Generates an SVG representation of a land installation symbol, categorized under 'Unknown'. The symbol is configured with a size of 40. ```javascript document.write(new ms.Symbol(100120, { size: 40 }).asSVG()); ``` -------------------------------- ### Generate Assumed Friend Symbol (Land Installation) Source: https://github.com/spatialillusions/milsymbol/blob/master/docs/milsymbol-2525e-APP6e.html Generates an SVG symbol for an assumed friendly entity in the Land Installation category. Ensure the 'standardEdition' variable is defined. ```javascript document.write( new ms.Symbol(standardEdition + "0215", { size: 40 }).asSVG() ); ```