1

I am trying to load a .qml style file to CORINE land cover maps, but the application generates an automatic color ramp.

Dataset:http://geoforall.hu/sites/default/files/geodata/clc-series_hun.zip

Update: The problem still exists in QGIS 3.4.

In QGIS 3.2 after loading qml, if I click "Apply" then colors change: After applying the colors change.

In QGIS 2x, loading the style from the qml works as expected:

enter image description here

The problematic CLC .qml style file:

<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="1.7.0-Trunk" minimumScale="0" maximumScale="1e+08" hasScaleBasedVisibilityFlag="0">
  <transparencyLevelInt>255</transparencyLevelInt>
  <rasterproperties>
    <mDrawingStyle>SingleBandPseudoColor</mDrawingStyle>
    <mColorShadingAlgorithm>ColorRampShader</mColorShadingAlgorithm>
    <mInvertColor boolean="false"/>
    <mRedBandName>Not Set</mRedBandName>
    <mGreenBandName>Not Set</mGreenBandName>
    <mBlueBandName>Not Set</mBlueBandName>
    <mGrayBandName>Band 1</mGrayBandName>
    <mStandardDeviations>0</mStandardDeviations>
    <mUserDefinedRGBMinimumMaximum boolean="false"/>
    <mRGBMinimumMaximumEstimated boolean="true"/>
    <mUserDefinedGrayMinimumMaximum boolean="false"/>
    <mGrayMinimumMaximumEstimated boolean="true"/>
    <mContrastEnhancementAlgorithm>NoEnhancement</mContrastEnhancementAlgorithm>
    <contrastEnhancementMinMaxValues>
      <minMaxEntry>
        <min>0</min>
        <max>255</max>
      </minMaxEntry>
    </contrastEnhancementMinMaxValues>
    <mNoDataValue mValidNoDataValue="true">0</mNoDataValue>
    <singleValuePixelList>
      <pixelListEntry pixelValue="0" percentTransparent="100"/>
    </singleValuePixelList>
    <threeValuePixelList>
      <pixelListEntry red="0" blue="0" green="0" percentTransparent="100"/>
    </threeValuePixelList>
    <customColorRamp>
      <colorRampType>DISCRETE</colorRampType>
        <colorRampEntry red="255" blue="255" green="255" value="0" label=""/>
        <colorRampEntry red="230" blue="77" green="0" value="111"       label="111 - Összefüggő település szerkezet"/>
        <colorRampEntry red="255" blue="0" green="0" value="112"        label="112 - Nem-összefüggő település szerkezet"/>
        <colorRampEntry red="204" blue="242" green="77" value="121"     label="121 - Ipari vagy kereskedelmi területek"/>
        <colorRampEntry red="204" blue="0" green="0" value="122"        label="122 - Út- és vasúthálózat és csatlakozó területek"/>
        <colorRampEntry red="230" blue="204" green="204" value="123"    label="123 - Kikötők"/>
        <colorRampEntry red="230" blue="230" green="204" value="124"    label="124 - Repülőterek"/>
        <colorRampEntry red="166" blue="204" green="0" value="131"      label="131 - Nyersanyag kitermelés"/>
        <colorRampEntry red="166" blue="0" green="77" value="132"       label="132 - Lerakóhelyek, meddőhányók"/>
        <colorRampEntry red="255" blue="255" green="77" value="133"     label="133 - Építési munkahelyek"/>
        <colorRampEntry red="255" blue="255" green="166" value="141"    label="141 - Városi zöldterületek"/>
        <colorRampEntry red="255" blue="255" green="230" value="142"    label="142 - Sport-, szabadidő-és üdülő területek"/>
        <colorRampEntry red="255" blue="168" green="255" value="211"    label="211 - Nem-öntözött szántóföldek"/>
        <colorRampEntry red="255" blue="0" green="255" value="212"      label="212 - Állandóan öntözött területek"/>
        <colorRampEntry red="230" blue="0" green="230" value="213"      label="213 - Rizs földek"/>
        <colorRampEntry red="230" blue="0" green="128" value="221"      label="221 - Szőlők"/>
        <colorRampEntry red="242" blue="77" green="166" value="222"     label="222 - Gyümölcsösök, bogyósok"/>
        <colorRampEntry red="230" blue="0" green="166" value="223"      label="223 - Olajfa-ültetvények"/>
        <colorRampEntry red="230" blue="77" green="230" value="231"     label="231 - Rét / legelő"/>
        <colorRampEntry red="255" blue="166" green="230" value="241"    label="241 - Egynyári kultúrák állandó kultúrákkal vegyesen"/>
        <colorRampEntry red="255" blue="77" green="230" value="242"     label="242 - Komplex művelési szerkezet"/>
        <colorRampEntry red="230" blue="77" green="204" value="243"     label="243 - Elsődlegesen mezőgazdasági területek jelentős természetes növényzettel"/>
        <colorRampEntry red="242" blue="166" green="204" value="244"    label="244 - Mezőgazdasági-erdészeti területek"/>
        <colorRampEntry red="128" blue="0" green="255" value="311"      label="311 - Lomblevelű erdők"/>
        <colorRampEntry red="0" blue="0" green="166" value="312"        label="312 - Tűlevelű erdők"/>
        <colorRampEntry red="77" blue="0" green="255" value="313"       label="313 - Vegyes erdők"/>
        <colorRampEntry red="204" blue="77" green="242" value="321"     label="321 - Természetes gyepek, természetközeli rétek"/>
        <colorRampEntry red="166" blue="128" green="255" value="322"    label="322 - Hangafüves, harasztos területek"/>
        <colorRampEntry red="166" blue="77" green="230" value="323"     label="323 - Keménylombú mediterrán növényzet"/>
        <colorRampEntry red="166" blue="0" green="242" value="324"      label="324 - Átmeneti erdős-cserjés területek"/>
        <colorRampEntry red="230" blue="230" green="230" value="331"    label="331 - Homokos tengerpartok, dűnék, homok"/>
        <colorRampEntry red="204" blue="204" green="204" value="332"    label="332 - Csupasz sziklák"/>
        <colorRampEntry red="204" blue="204" green="255" value="333"    label="333 - Ritkás növényzet"/>
        <colorRampEntry red="0" blue="0" green="0" value="334"          label="334 - Leégett területek"/>
        <colorRampEntry red="166" blue="204" green="230" value="335"    label="335 - Gleccserek, örök hó"/>
        <colorRampEntry red="166" blue="255" green="166" value="411"    label="411 - Szárazföldi mocsarak"/>
        <colorRampEntry red="77" blue="255" green="77" value="412"      label="412 - Tőzeglápok"/>
        <colorRampEntry red="204" blue="255" green="204" value="421"    label="421 - Tengermelléki mocsarak"/>
        <colorRampEntry red="230" blue="255" green="230" value="422"    label="422 - Sólepárlók"/>
        <colorRampEntry red="166" blue="230" green="166" value="423"    label="423 - Ár-apály által érintett területek"/>
        <colorRampEntry red="0" blue="242" green="204" value="511"      label="511 - Folyóvizek, vízi utak"/>
        <colorRampEntry red="128" blue="230" green="242" value="512"    label="512 - Állóvizek"/>
        <colorRampEntry red="0" blue="166" green="255" value="521"      label="521 - Tengerparti lagúnák"/>
        <colorRampEntry red="166" blue="230" green="255" value="522"    label="522 - Folyótorkolatok"/>
        <colorRampEntry red="230" blue="255" green="242" value="523"    label="523 - Tenger és óceán "/>
        <colorRampEntry red="0" blue="0" green="0" value="999"          label="999 - NODATA"/>
        <colorRampEntry red="255" blue="255" green="255" value="990"    label="990 - UNCLASSIFIED LAND SURFACE"/>
        <colorRampEntry red="230" blue="255" green="242" value="995"    label="995 - UNCLASSIFIED WATER BODIES"/>
        <colorRampEntry red="255" blue="255" green="255" value="990"    label="990 - UNCLASSIFIED"/>
    </customColorRamp>
  </rasterproperties>
</qgis>
  • Similar issue gis.stackexchange.com/q/284872/2856 – user2856 Sep 3 '18 at 22:01
  • I downloaded your data and i didn't have problems, what is your problem? could you show us an image? – Carlos López Quintanilla Sep 3 '18 at 22:22
  • An imperfect solution if you use the same name for the .qml and .tiff file. – pnz Sep 4 '18 at 15:51
  • @Carlos López Quintanilla : What version do you use? – pnz Sep 19 '18 at 21:33
  • I use QGIS 3.2 "Bonn" – Carlos López Quintanilla Sep 20 '18 at 11:15
3

Try to modify this template:

**Here is an example of a working .qml:**
`<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="2.18.18" minimumScale="inf" maximumScale="1e+08" hasScaleBasedVisibilityFlag="0">
  <pipe>
    <rasterrenderer opacity="1" alphaBand="-1" classificationMax="11.485" classificationMinMaxOrigin="unknown" band="1" classificationMin="0.5" type="singlebandpseudocolor">
      <rasterTransparency/>
      <rastershader>
        <colorrampshader colorRampType="DISCRETE" clip="0">
          <item alpha="179" value="1" label="&lt;= 1" color="#0571b0"/>
          <item alpha="179" value="4" label="1 - 4" color="#92c5de"/>
          <item alpha="179" value="6" label="4 - 6" color="#f7f7f7"/>
          <item alpha="179" value="8" label="6 - 8" color="#f4a582"/>
          <item alpha="166" value="inf" label="> 8" color="#ca0020"/>
        </colorrampshader>
      </rastershader>
    </rasterrenderer>
    <brightnesscontrast brightness="0" contrast="0"/>
    <huesaturation colorizeGreen="128" colorizeOn="0" colorizeRed="255" colorizeBlue="128" grayscaleMode="0" saturation="0" colorizeStrength="100"/>
    <rasterresampler maxOversampling="2"/>
  </pipe>
  <blendMode>0</blendMode>
</qgis>
  • Thanks for the advice, I gonna check it, and accept if working. – pnz Nov 1 '18 at 23:24
  • I removed some parts of your answer, which mislead me a bit. The provided good template solved the issue, after the review I will accept your answer. – pnz Feb 16 at 23:51
  • 2
    Glad it helped you. I feel like the current answer will not be very helpful to many people especially those new to QGIS. Did this method work for you? In QGIS 3: Go to layer properties > style. Now load the qml but before closing the dialog open "Min/max value setting" and select "User defined". – Baswein Feb 19 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.