From 3f5b76f97404d469534c5475a989aacc69dc05ca Mon Sep 17 00:00:00 2001
From: John Cardeccia <john@pop-os.localdomain>
Date: Tue, 26 Sep 2023 15:12:14 -0700
Subject: [PATCH] added partial solution to find_symbol()

---
 src/leaflet.sld.js | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/leaflet.sld.js b/src/leaflet.sld.js
index 430a8937c..41388107d 100644
--- a/src/leaflet.sld.js
+++ b/src/leaflet.sld.js
@@ -360,8 +360,28 @@ L.SLDStyler = L.Class.extend({
 
    find_symbol: function() {
 
-      
-      
+      const svgFileList = require.context(
+         './images/FGDC_svgs/', true, /\.svg$/
+      ); // Load all files in listed folder and all sub directories
+
+      console.log(svgFileList); // Testing: Print to console
+
+      const svgFileKeys = svgFileList.keys();  // Set varaible to 'key' containing all file paths and names
+
+      for( let index = 0; index < svgFileKeys.length; index++ ) // Loop through all file names listed in key
+      {
+         var svgFileName = svgFileKeys[ index ]; // Set variable name to file path at current index
+
+         if( svgFileName.split(/[\\/]/).pop() == '25.82.svg') // Isolate file name from the file's path and compare to search criteria
+         {
+            var svgFile = svgFileKeys[ index ]; // Set file variable to path of matching file
+            console.log(svgFile); // Testing: Print to console
+         }
+         // Add else statement to handle situations where a file isn't located
+      }
+
+      // Figure out how to grab the contents of the located file. 
+         // Issue: browser security features generally prevent local file access
    },
 
    symbolize_with_icons: function(geolayer, map){
-- 
GitLab