Hi Hamish

I am trying to install your r.colors.out_sld plugin using g.extension, but I am getting the following error message:

Compiling...
/tmp/grass7-paulo-7909/tmpBesVaZ/r.colors.out_sld/docs/html/r.colors.out_sld.html:73:0:
 Error (IndexError('pop from empty list',)): export of contious color rules 
(ramp).</p>

make: *** 
[/tmp/grass7-paulo-7909/tmpBesVaZ/r.colors.out_sld/docs/man/man1/r.colors.out_sld.1]
 Error 1
ERROR: Compilation failed, sorry. Please check above error messages.

This looks like it might be an issue with the html page, which does not seem to follow the guidelines. Attached a patch file (r.colors.out_sld_html.patch) with some changes to comply with the guidelines, which perhaps solves above.

After copying the script to the script folder, the plugin runs fine for maps with categories, but gives an error for raster layers without categories. The attached patch (r.colors.out_sld.patch) corrects this I hope.

Best wishes,

Paulo

--- /home/paulo/.grass7/addons/scripts/r.colors.out_sld
+++ /home/paulo/.grass7/addons/scripts/r.colors.out_sld2
@@ -99,8 +99,12 @@
     if maptype == 'CELL':
         grass.verbose('Reading category lables, may take a while...')
         categories = grass.parse_command('r.category', map=map, separator='=')
-    if list(set(categories.values()))[0] or len(list(set(categories.values()))) > 1:
-        use_categories = True
+        if list(set(categories.values()))[0] or len(list(set(categories.values()))) > 1:
+            use_categories = True
+        else:
+            use_categories = False
+    else:
+        use_categories = False
 
     # Initialize SLD with header
     sld = u"""<?xml version="1.0" encoding="UTF-8"?>
--- /home/paulo/Software/Linux/grass7/addon/raster/r.colors.out_sld/r.colors.out_sld.html
+++ /home/paulo/Desktop/r.colors.out_sld.html
@@ -1,36 +1,31 @@
 <h2>DESCRIPTION:</h2>
-<p>The module <em>r.colors.out_sld</em> exports the colors of a raster map into 
-the Styled Layer Description (SLD) format according to OGC standard.</p>
-For raster maps of tyoe CELL also lables are exported. The export if lables 
-requires that the input map is read and may thus take a bit longer than the 
-export of contious color rules (ramp).</p>
-<p>Currently only SLD v1.0.0 is implemented.</p>
 
-<div id="examples">
+The module <em>r.colors.out_sld</em> exports the colors of a raster map into
+the Styled Layer Description (SLD) format according to OGC standard.
+
+<p>For raster maps of tyoe CELL also lables are exported. The export if lables
+requires that the input map is read and may thus take a bit longer than the
+export of contious color rules (ramp).
+
+<p>Currently only SLD v1.0.0 is implemented.
 
 <h2>EXAMPLES:</h2>
-<div class="code"><pre>
-# Exporting a color ramp
-r.out.colors_sld map=Testmap style_name=Celsius
 
-</pre></div>
+<div class="code">
+<pre># Exporting a color ramp
+r.out.colors_sld map=Testmap style_name=Celsius</pre>
 </div>
 
-<div id="seealso">
+<h2>SEE ALSO:</h2>
 
-<h2>SEE ALSO:</h2>
 <a href="r.colors.out.html">r.colors.out</a>
-</div>
-
-<div id="references">
 
 <h2>REFERENCES:</h2>
+
 <a href="http://www.opengeospatial.org/standards/sld";>
 http://www.opengeospatial.org/standards/sld</a><br></div>
 
-<div id="author">
+<h2>AUTHORS:</h2>
 
-<h2>AUTHORS:</h2>
 Hamish Bowman<br>
 Stefan Blumentrath, Norwegian Institute for Nature Research, Oslo, Norway<br>
-</div>
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to