MSBilgin / SLD4raster

QGIS plugin to generate SLD (Styled Layer Descriptor) for raster layers.
http://cbsuygulama.wordpress.com
6 stars 1 forks source link

An error has occurred while executing Python code (QGIS 3.4.3 #6

Open starbal opened 5 years ago

starbal commented 5 years ago

Getting this error every time I try to run the extension on a Paletted/Unique Value legend. (the extension works fine for rendertype Singleband pseudocolor)

I am using the latest version of QGIS, 3.4.3-Madeira

An error has occurred while executing Python code:

2019-01-09T12:01:17 WARNING Traceback (most recent call last): File "C:/Users/stari002/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SLD4raster\sld4raster.py", line 444, in qml2Sld colorType = str(qmlString.getElementsByTagName('colorrampshader')[0].attributes['colorRampType'].value) IndexError: list index out of range

image

starbal commented 5 years ago

The legend of the layer, saved in qml format, looks like this:

<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="3.4.3-Madeira" minScale="1e+08" styleCategories="AllStyleCategories" hasScaleBasedVisibilityFlag="0" maxScale="0">
  <flags>
    <Identifiable>1</Identifiable>
    <Removable>1</Removable>
    <Searchable>1</Searchable>
  </flags>
  <customproperties>
    <property key="WMSBackgroundLayer" value="false"/>
    <property key="WMSPublishDataSourceUrl" value="false"/>
    <property key="embeddedWidgets/count" value="0"/>
    <property key="identify/format" value="Value"/>
  </customproperties>
  <pipe>
    <rasterrenderer alphaBand="-1" type="paletted" opacity="1" band="1">
      <rasterTransparency/>
      <minMaxOrigin>
        <limits>None</limits>
        <extent>WholeRaster</extent>
        <statAccuracy>Estimated</statAccuracy>
        <cumulativeCutLower>0.02</cumulativeCutLower>
        <cumulativeCutUpper>0.98</cumulativeCutUpper>
        <stdDevFactor>2</stdDevFactor>
      </minMaxOrigin>
      <colorPalette>
        <paletteEntry label="Nat grasland" alpha="255" color="#006100" value="1"/>
        <paletteEntry label="Vochtig grasland" alpha="255" color="#619900" value="2"/>
        <paletteEntry label="Matig vochtig grasland" alpha="255" color="#c5db00" value="3"/>
        <paletteEntry label="Droog grasland" alpha="255" color="#ffffbe" value="4"/>
        <paletteEntry label="Akker" alpha="255" color="#a87000" value="888"/>
        <paletteEntry label="Geen akker, geen grasland" alpha="255" color="#e1e1e1" value="999"/>
      </colorPalette>
      <colorramp type="randomcolors" name="[source]"/>
    </rasterrenderer>
    <brightnesscontrast contrast="0" brightness="0"/>
    <huesaturation grayscaleMode="0" colorizeGreen="128" colorizeBlue="128" colorizeRed="255" saturation="0" colorizeOn="0" colorizeStrength="100"/>
    <rasterresampler maxOversampling="2"/>
  </pipe>
  <blendMode>0</blendMode>
</qgis>