|
| 1 | +# Lizmap External WMS Legend Icon Fix - Official Release Package |
| 2 | + |
| 3 | +## 📦 Release Information |
| 4 | + |
| 5 | +**Version:** 3.11.0-pre (with external WMS legend fix) |
| 6 | +**Branch:** `external-wms-legend-icon` |
| 7 | +**Commit:** `1e8f8bab8` - "Fix: Display legend for external WMS layers" |
| 8 | +**Build Date:** 2025-11-07 |
| 9 | +**Build Number:** 9210 |
| 10 | + |
| 11 | +## 🎯 What's Fixed |
| 12 | + |
| 13 | +External WMS layers were showing empty legend icons because QGIS Server returns empty icon fields in JSON GetLegendGraphic responses. |
| 14 | + |
| 15 | +### Changes Made |
| 16 | + |
| 17 | +1. **New Method in WMS.js:** |
| 18 | + - Added `getLegendGraphicPNG()` method to fetch PNG format legends |
| 19 | + - Located in `assets/src/modules/WMS.js` (lines 90-113) |
| 20 | + |
| 21 | +2. **Enhanced Symbology.js:** |
| 22 | + - Detects external WMS layers via `externalWmsToggle` property |
| 23 | + - Fetches PNG legend and converts to base64 for external WMS |
| 24 | + - Normal layers continue using JSON format (no breaking changes) |
| 25 | + - Located in `assets/src/modules/action/Symbology.js` (lines 35-82) |
| 26 | + |
| 27 | +## 📥 Installation Options |
| 28 | + |
| 29 | +### Option 1: Full Installation (Recommended) |
| 30 | + |
| 31 | +This replaces your entire Lizmap installation with the patched version. |
| 32 | + |
| 33 | +**⚠️ IMPORTANT: This is a pre-release (3.11.0-pre). Only use for testing!** |
| 34 | + |
| 35 | +1. **Backup your current installation:** |
| 36 | + ```bash |
| 37 | + cd /var/www |
| 38 | + tar -czf lizmap-backup-$(date +%Y%m%d).tar.gz lizmap/ |
| 39 | + ``` |
| 40 | + |
| 41 | +2. **Download and extract the package:** |
| 42 | + ```bash |
| 43 | + # Upload lizmap_web_client.zip to your server |
| 44 | + unzip lizmap_web_client.zip |
| 45 | + ``` |
| 46 | + |
| 47 | +3. **Replace your installation:** |
| 48 | + ```bash |
| 49 | + # Remove old installation (or rename it) |
| 50 | + mv lizmap lizmap-old |
| 51 | + |
| 52 | + # Move new installation |
| 53 | + mv lizmap_web_client lizmap |
| 54 | + ``` |
| 55 | + |
| 56 | +4. **Restore your configuration:** |
| 57 | + ```bash |
| 58 | + # Copy your config files from backup |
| 59 | + cp lizmap-old/lizmap/var/config/lizmapConfig.ini.php lizmap/lizmap/var/config/ |
| 60 | + cp lizmap-old/lizmap/var/config/localconfig.ini.php lizmap/lizmap/var/config/ |
| 61 | + cp lizmap-old/lizmap/var/config/profiles.ini.php lizmap/lizmap/var/config/ |
| 62 | + |
| 63 | + # Copy your jcommunity config if you use it |
| 64 | + cp lizmap-old/lizmap/var/config/jcommunity/config.ini.php lizmap/lizmap/var/config/jcommunity/ 2>/dev/null || true |
| 65 | + |
| 66 | + # Restore file permissions |
| 67 | + cd lizmap/lizmap/ |
| 68 | + chown -R www-data:www-data temp/ var/ www/cache/ |
| 69 | + ``` |
| 70 | + |
| 71 | +5. **Clear cache and test:** |
| 72 | + ```bash |
| 73 | + rm -rf lizmap/lizmap/temp/lizmap/* |
| 74 | + # Clear browser cache (Ctrl+F5) |
| 75 | + ``` |
| 76 | + |
| 77 | +### Option 2: JavaScript Files Only (Quick Test) |
| 78 | + |
| 79 | +This only replaces the JavaScript files - faster but requires matching Lizmap version. |
| 80 | + |
| 81 | +1. **Backup JavaScript files:** |
| 82 | + ```bash |
| 83 | + cd /var/www/lizmap |
| 84 | + cp -r lizmap/www/assets/js lizmap/www/assets/js.backup-$(date +%Y%m%d) |
| 85 | + ``` |
| 86 | + |
| 87 | +2. **Extract and copy new JS files:** |
| 88 | + ```bash |
| 89 | + # Extract the package |
| 90 | + unzip lizmap_web_client.zip |
| 91 | + |
| 92 | + # Copy only the JS files |
| 93 | + cp -r lizmap_web_client/lizmap/www/assets/js/* /var/www/lizmap/lizmap/www/assets/js/ |
| 94 | + ``` |
| 95 | + |
| 96 | +3. **Clear browser cache (Ctrl+F5 or Cmd+Shift+R)** |
| 97 | + |
| 98 | +### Option 3: Using the Named Package |
| 99 | + |
| 100 | +The release also includes `lizmap-web-client-3.11.0-pre.zip` which is identical to `lizmap_web_client.zip` but has a versioned directory name. |
| 101 | + |
| 102 | +## 📋 Package Contents |
| 103 | + |
| 104 | +### Main Package: `lizmap_web_client.zip` (13 MB) |
| 105 | +- Complete Lizmap Web Client installation |
| 106 | +- All PHP backend files with dependencies |
| 107 | +- Compiled JavaScript with your external WMS legend fix |
| 108 | +- Configuration templates |
| 109 | +- Documentation |
| 110 | + |
| 111 | +### Additional Packages: |
| 112 | +- `lizmap-web-client-3.11.0-pre.zip` (13 MB) - Same as above with version in folder name |
| 113 | +- `lizmapdemo-module-3.11.zip` (4.6 MB) - Demo module |
| 114 | + |
| 115 | +## ✅ Testing Checklist |
| 116 | + |
| 117 | +After installation, verify: |
| 118 | + |
| 119 | +- [ ] External WMS layers display legend icons correctly |
| 120 | +- [ ] Regular (non-external) layers still show legends properly |
| 121 | +- [ ] Layer symbology switching works |
| 122 | +- [ ] No JavaScript errors in browser console (F12) |
| 123 | +- [ ] No performance degradation |
| 124 | +- [ ] Layer tree loads correctly |
| 125 | +- [ ] Map displays and functions normally |
| 126 | + |
| 127 | +## 🔍 How to Test External WMS Legends |
| 128 | + |
| 129 | +1. Add an external WMS layer to your QGIS project |
| 130 | +2. Configure it as an external WMS in Lizmap plugin |
| 131 | +3. Publish the project |
| 132 | +4. Open the map in Lizmap |
| 133 | +5. Check that the layer legend icon displays in the layer tree |
| 134 | +6. Before the fix: icon would be empty |
| 135 | +7. After the fix: icon should show the actual legend from the WMS service |
| 136 | + |
| 137 | +## 🔄 Rollback Instructions |
| 138 | + |
| 139 | +### If using Full Installation: |
| 140 | +```bash |
| 141 | +cd /var/www |
| 142 | +rm -rf lizmap |
| 143 | +mv lizmap-old lizmap |
| 144 | +# Restart web server |
| 145 | +systemctl restart apache2 # or nginx |
| 146 | +``` |
| 147 | + |
| 148 | +### If using JavaScript Only: |
| 149 | +```bash |
| 150 | +cd /var/www/lizmap |
| 151 | +rm -rf lizmap/www/assets/js |
| 152 | +mv lizmap/www/assets/js.backup-YYYYMMDD lizmap/www/assets/js |
| 153 | +# Clear browser cache |
| 154 | +``` |
| 155 | + |
| 156 | +## 🧪 Build Quality |
| 157 | + |
| 158 | +- ✅ **Build Status:** Successful (no errors) |
| 159 | +- ✅ **Unit Tests:** All passing (12/12) |
| 160 | + - WMS tests: 4/4 ✅ |
| 161 | + - Symbology tests: 8/8 ✅ |
| 162 | +- ✅ **PHP Dependencies:** Installed via Composer |
| 163 | +- ✅ **JS Dependencies:** Installed via npm |
| 164 | +- ✅ **Package Integrity:** Created using official Makefile process |
| 165 | + |
| 166 | +## 📝 Build Details |
| 167 | + |
| 168 | +- **Node.js:** v20.19.5 |
| 169 | +- **npm:** 10.8.2 |
| 170 | +- **PHP:** 7.4.3 |
| 171 | +- **Composer:** 2.8.12 |
| 172 | +- **Build Tool:** rspack (Lizmap's official bundler) |
| 173 | +- **Build Time:** ~2.32 seconds |
| 174 | + |
| 175 | +## ⚠️ Important Notes |
| 176 | + |
| 177 | +1. **This is a pre-release version (3.11.0-pre)** - Use for testing only |
| 178 | +2. **Backup before installing** - Always backup your current installation |
| 179 | +3. **Test in staging first** - Don't deploy directly to production |
| 180 | +4. **Configuration compatibility** - This is based on Lizmap 3.11.0-pre, ensure compatibility |
| 181 | +5. **Browser cache** - Always clear browser cache after updating JS files |
| 182 | + |
| 183 | +## 🐛 Reporting Issues |
| 184 | + |
| 185 | +If you encounter problems: |
| 186 | + |
| 187 | +1. Check browser console for JavaScript errors (F12 > Console) |
| 188 | +2. Check server logs for PHP errors |
| 189 | +3. Provide: |
| 190 | + - Steps to reproduce |
| 191 | + - Browser console errors |
| 192 | + - Server error logs |
| 193 | + - QGIS Server version |
| 194 | + - External WMS service URL (if not sensitive) |
| 195 | + |
| 196 | +## 📚 Technical Details |
| 197 | + |
| 198 | +### File Locations in Package: |
| 199 | +- Built JS: `lizmap_web_client/lizmap/www/assets/js/lizmap.js` |
| 200 | +- Source maps: `lizmap_web_client/lizmap/www/assets/js/*.map` |
| 201 | +- PHP backend: `lizmap_web_client/lizmap/` |
| 202 | +- Config templates: `lizmap_web_client/lizmap/var/config/*.dist` |
| 203 | + |
| 204 | +### Modified Source Files (for reference): |
| 205 | +- `assets/src/modules/WMS.js` - New getLegendGraphicPNG() method |
| 206 | +- `assets/src/modules/action/Symbology.js` - External WMS detection logic |
| 207 | + |
| 208 | +## 🚀 Next Steps |
| 209 | + |
| 210 | +After successful testing: |
| 211 | + |
| 212 | +1. **For your own use:** |
| 213 | + - Deploy to production with proper backup |
| 214 | + - Monitor for any issues |
| 215 | + |
| 216 | +2. **To contribute back:** |
| 217 | + - Create a pull request to the upstream repository |
| 218 | + - Include test results and screenshots |
| 219 | + - Reference issue #[number] if applicable |
| 220 | + |
| 221 | +## 📄 License |
| 222 | + |
| 223 | +This is a modified version of Lizmap Web Client, which is licensed under Mozilla Public License 2.0 (MPL-2.0). |
| 224 | + |
| 225 | +--- |
| 226 | + |
| 227 | +**Built with ❤️ for the Lizmap community** |
0 commit comments