Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting raster style to SLD only works when output file has .sld suffix #35944

Closed
NyakudyaA opened this issue Apr 23, 2020 · 12 comments · Fixed by #36774
Closed

Exporting raster style to SLD only works when output file has .sld suffix #35944

NyakudyaA opened this issue Apr 23, 2020 · 12 comments · Fixed by #36774
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers

Comments

@NyakudyaA
Copy link
Contributor

Problem

I have symbolized a raster layer and when I try to export it as an SLD it always saves it as QML.

qgis

@NyakudyaA NyakudyaA added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Apr 23, 2020
@gioman
Copy link
Contributor

gioman commented Apr 25, 2020

@NyakudyaA cannot confirm here.

@gioman gioman added the Feedback Waiting on the submitter for answers label Apr 25, 2020
@NyakudyaA
Copy link
Contributor Author

@NyakudyaA cannot confirm here.

I will build again and test

@MaxDragonheart
Copy link

I have the same problem. I'm using 3.10.5 on Ubuntu 18.04 and I can't create the .sld for a raster. I've tried to do the same with 3.4 on onother PC with Windows 10 and is possible to create the .sld.

@gioman
Copy link
Contributor

gioman commented May 4, 2020

I have the same problem. I'm using 3.10.5 on Ubuntu 18.04 and I can't create the .sld for a raster. I've tried to do the same with 3.4 on onother PC with Windows 10 and is possible to create the .sld.

@MaxDragonheart attach a sample of the raster you are styling as also the style in .qml format, thanks.

@MaxDragonheart
Copy link

@gioman you can download the data here.

@gioman
Copy link
Contributor

gioman commented May 4, 2020

@MaxDragonheart this is the SLD I get in master:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" version="1.0.0">
  <UserLayer>
    <sld:LayerFeatureConstraints>
      <sld:FeatureTypeConstraint/>
    </sld:LayerFeatureConstraints>
    <sld:UserStyle>
      <sld:Name>ndvi</sld:Name>
      <sld:FeatureTypeStyle>
        <sld:Rule>
          <sld:RasterSymbolizer>
            <sld:ChannelSelection>
              <sld:GrayChannel>
                <sld:SourceChannelName>1</sld:SourceChannelName>
              </sld:GrayChannel>
            </sld:ChannelSelection>
            <sld:ColorMap type="ramp">
              <sld:ColorMapEntry quantity="0" label="0" color="#d7191c"/>
              <sld:ColorMapEntry quantity="0.1" label="0.1" color="#e75437"/>
              <sld:ColorMapEntry quantity="0.2" label="0.2" color="#f69053"/>
              <sld:ColorMapEntry quantity="0.3" label="0.3" color="#febe74"/>
              <sld:ColorMapEntry quantity="0.4" label="0.4" color="#ffdf9a"/>
              <sld:ColorMapEntry quantity="0.5" label="0.5" color="#ffffc0"/>
              <sld:ColorMapEntry quantity="0.6" label="0.6" color="#dcf09e"/>
              <sld:ColorMapEntry quantity="0.7" label="0.7" color="#b8e17b"/>
              <sld:ColorMapEntry quantity="0.8" label="0.8" color="#8acc62"/>
              <sld:ColorMapEntry quantity="0.9" label="0.9" color="#52b151"/>
              <sld:ColorMapEntry quantity="1" label="1" color="#1a9641"/>
            </sld:ColorMap>
          </sld:RasterSymbolizer>
        </sld:Rule>
      </sld:FeatureTypeStyle>
    </sld:UserStyle>
  </UserLayer>
</StyledLayerDescriptor>

seems pretty much the same as the one you attached.

@MaxDragonheart
Copy link

@gioman here you can see what happen to me when I try to create an .sld
This happen only with raster layers; whit vectors I can create the .sld without problems.

@MaxDragonheart
Copy link

This is my QGIS version
Screenshot from 2020-05-04 14-04-12

@gioman
Copy link
Contributor

gioman commented May 4, 2020

@gioman here you can see what happen to me when I try to create an .sld
This happen only with raster layers; whit vectors I can create the .sld without problems.

I can't replicate following the same steps on a different DM.

@NyakudyaA
Copy link
Contributor Author

@gioman here you can see what happen to me when I try to create an .sld
This happen only with raster layers; whit vectors I can create the .sld without problems.

I can't replicate following the same steps on a different DM.

@gioman I can replicate. I have debugged what is happening

  • When you try to export the SLD from master and you just write the name of the file it defaults to saving a QML.
  • In the file selector if you choose a name like test.sld then you will actually get a valid SLD but without writting the extension it defaults to a QML

@gioman
Copy link
Contributor

gioman commented May 4, 2020

* In the file selector if you choose a name like `test.sld` then you will actually get a valid SLD but without writting the extension it defaults to a QML

not on KDE. I haven't tested on Windows.

@MaxDragonheart
Copy link

@NyakudyaA with your indication it is possible to create the .sld

@alexbruy alexbruy changed the title Raster SLD exporter broken in master Exporting raster style to SLD only works when output file has .sld suffix May 27, 2020
alexbruy added a commit that referenced this issue May 28, 2020
improve logic for choosing style type when exporting raster style (fix #35944)
nyalldawson pushed a commit to nyalldawson/QGIS that referenced this issue May 28, 2020
nyalldawson pushed a commit that referenced this issue Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants