Hi Chris<div><br></div><div>this is very nice! I indeed didn't know this trick and will certainly use it again in the future!</div><div><br></div><div>However... :-)</div><div><br></div><div>I am currently teaching QGIS to beginners and this for sure is not an appropriate method for them (especially in the case you have to generate the symbology file through a script)!</div><div><br></div><div>Since the user can style continuous rasters with some "button-clicking", I believe the same option should be available for discrete rasters as well. </div><div><br></div><div>I am thus wondering if anyone else than me sees it as a priority for QGIS? If yes, how to motivate the developers to take it for the next release and / or how much would such a development cost? (I unfortunately don't have the competences to do it myself)</div><div><br></div><div>Thanks again and cheers!</div><div><br></div><div>Stéphane</div><div><br><br>Le mardi 10 janvier 2017, Chris House <<a href="mailto:housec01@gmail.com">housec01@gmail.com</a>> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi Stéphane,<br><br>I don't know if this is what you are looking for or not but I have a method of classifying rasters by color based on a set (standard) colors.  I created a spreadsheet that has several required columns, value, red, green, blue...and you can have an optional field for a display value.  So say value 1 is water you can use that last column to name that value so that in the QGIS layer tree and in legend it says Water instead of value 1.  <br><br></div><div>save the spreadsheet as a csv and change the extension to .txt instead of .csv.<br></div><div><br></div>I then go into the symbology section of the raster choose singleband pseudocolor. Use the folder to browse to your text file and click add.  There is a format for this text file.  It is below.  If you need me to email it I will do that in direct email.<br><br># QGIS Generated Color Map Export File<br>INTERPOLATION:EXACT<br>-9999,0,0,0,255,NoData<br>0,176,176,176,255,Non-Forested<br>15,234,255,191,255,10 <=  CC < 20<br>25,187,230,149,255,20 <=  CC < 30<br>35,140,201,109,255,30 <=  CC < 40<br>45,98,176,74,255,40 <=  CC < 50<br>55,59,153,43,255,50 <= CC < 60<br>65,0,128,0,255,60 <=  CC < 70<br>75,15,92,11,255,70 <=  CC < 80<br>85,17,61,12,255,80 <=  CC < 90<br>95,16,36,12,255,90 <=  CC <= 100<br><br></div>In my example if I don't assign a value it gets ignored by QGIS.  If you are wondering how to assign unique colors to say 200 unique values...just script it.  I have done this and as long as you have the number of unique values you want and to make them unique in the script it works.<br><br></div>I hope this helps.  I know it isn't a "button" but to be honest I like this better.  If you already knew this...well then maybe it will help someone out in the future.<br><br></div>--Chris<br><div><div><div><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 9, 2017 at 3:00 PM,  <span dir="ltr"><<a href="javascript:_e(%7B%7D,'cvml','qgis-user-request@lists.osgeo.org');" target="_blank">qgis-user-request@lists.<wbr>osgeo.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send Qgis-user mailing list submissions to<br>
        <a href="javascript:_e(%7B%7D,'cvml','qgis-user@lists.osgeo.org');" target="_blank">qgis-user@lists.osgeo.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-user</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="javascript:_e(%7B%7D,'cvml','qgis-user-request@lists.osgeo.org');" target="_blank">qgis-user-request@lists.osgeo.<wbr>org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="javascript:_e(%7B%7D,'cvml','qgis-user-owner@lists.osgeo.org');" target="_blank">qgis-user-owner@lists.osgeo.or<wbr>g</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Qgis-user digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: Symbolizing a discrete or a boolean raster (Stéphane Henriod)<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
Message: 1<br>
Date: Mon, 9 Jan 2017 23:07:36 +0600<br>
From: Stéphane Henriod <<a href="javascript:_e(%7B%7D,'cvml','s@henriod.info');" target="_blank">s@henriod.info</a>><br>
To: Enrico Fiore <<a href="javascript:_e(%7B%7D,'cvml','enricofiore@libero.it');" target="_blank">enricofiore@libero.it</a>><br>
Cc: qgis-user <<a href="javascript:_e(%7B%7D,'cvml','qgis-user@lists.osgeo.org');" target="_blank">qgis-user@lists.osgeo.org</a>><br>
Subject: Re: [Qgis-user] Symbolizing a discrete or a boolean raster<br>
Message-ID:<br>
        <<a href="javascript:_e(%7B%7D,'cvml','CAK6pVBXURm_e7dRP%2B8SP9amPUUX0%2BCn3GVxLPNjOHhno85o2rA@mail.gmail.com');" target="_blank">CAK6pVBXURm_e7dRP+8SP9amPUUX0<wbr>+Cn3GVxLPNjOHhno85o2rA@mail.gm<wbr>ail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi<br>
<br>
thanks for following up!<br>
<br>
It actually does part of the job!<br>
<br>
Using *Color interpretation: Exact*, I can indeed input the exact values I<br>
want to display (1,5 and 10) and all other pixels are hidden.<br>
<br>
HOWEVER,<br>
<br>
this still feels like a workaround:<br>
<br>
   - In the case of a discrete raster with many (> 50) unique values, I do<br>
   not want to input all of them manually<br>
   - In some cases, I do not know in advance all the unique values of my<br>
   raster<br>
   - If I click on *Classify*, QGIS will choose X values (based on the<br>
   number of classes and the classification method (continuous or equal<br>
   interval)), which no longer match the "exact" values of my raster. It<br>
   doesn't really make sense to classify a discrete rendering<br>
<br>
So I would say, we still need a render type "discrete raster" which offers<br>
the function to "retrieve all unique values" (and automatically apply a<br>
discrete color ramp)<br>
<br>
Attached a (fake) test dataset.<br>
<br>
Thanks and cheers<br>
<br>
Stéphane<br>
<br>
<br>
Le lundi 9 janvier 2017, Enrico Fiore <<a href="javascript:_e(%7B%7D,'cvml','enricofiore@libero.it');" target="_blank">enricofiore@libero.it</a>> a écrit :<br>
<br>
> Hi,<br>
> Sorry I can't do test, but if you use exact in color interpolation<br>
> parameter?<br>
><br>
> Cheers<br>
><br>
> Enrico<br>
<br>
<br>
Le lundi 9 janvier 2017, Stéphane Henriod <<a href="javascript:_e(%7B%7D,'cvml','s@henriod.info');" target="_blank">s@henriod.info</a>> a écrit :<br>
<br>
> Hi<br>
><br>
> unfortunately this is doing quite something different!<br>
><br>
> If I have a raster with 10 Landcover classes (1,2,3,4,5,6,7,8,9,10) and I<br>
> want to display only 1,5 and 10, using *Discrete *(1: red, 5: yellow, 10:<br>
> blue) the following will happen:<br>
><br>
> All pixels between 1 and 4 will be red<br>
> All pixels between 5 and 9 will be yellow<br>
> All pixels with 10 will be blue<br>
><br>
> In this sense, the pixels are indeed not interpolated, but this still is<br>
> not the behavior I am expecting when styling discrete rasters.<br>
><br>
> A "style discrete raster" function should offer the following:<br>
><br>
>    - Automatically recover all unique values from the raster<br>
>    - Only display the pixels to which the user has explicitly assigned a<br>
>    color<br>
><br>
> But thanks for your hint, this can be helpful in other cases!<br>
><br>
> Cheers<br>
><br>
> Stéphane<br>
><br>
><br>
> Le lundi 9 janvier 2017, Enrico Fiore <<a href="javascript:_e(%7B%7D,'cvml','enricofiore@libero.it');" target="_blank">enricofiore@libero.it</a><br>
> <javascript:_e(%7B%7D,'cvml','<a href="javascript:_e(%7B%7D,'cvml','enricofiore@libero.it');" target="_blank"><wbr>enricofiore@libero.it</a>');>> a écrit :<br>
><br>
>> Hi,<br>
>> I think that the solution is in the QGIS documentation, that you can read<br>
>> here: <a href="http://docs.qgis.org/2.14/en/docs/user_manual/working_with_r" rel="noreferrer" target="_blank">http://docs.qgis.org/2.14/en/d<wbr>ocs/user_manual/working_with_r</a><br>
>> aster/raster_properties.html#b<wbr>and-rendering<br>
>> you have to use *Singleband pseudocolor *and set color interpolation to<br>
>> Discrete.<br>
>><br>
>> Enrico<br>
>><br>
>><br>
>> ----Messaggio originale----<br>
>> Da: "Stéphane Henriod" <<a href="javascript:_e(%7B%7D,'cvml','s@henriod.info');" target="_blank">s@henriod.info</a>><br>
>> Data: 09/01/2017 6.30<br>
>> A: "qgis-user"<<a href="javascript:_e(%7B%7D,'cvml','qgis-user@lists.osgeo.org');" target="_blank">qgis-user@lists.os<wbr>geo.org</a>><br>
>> Ogg: [Qgis-user] Symbolizing a discrete or a boolean raster<br>
>><br>
>> Dear all<br>
>><br>
>> As much as I love QGIS and use it in my everyday life, there is one<br>
>> feature that I find particularly annoying: the styling of discrete rasters.<br>
>><br>
>> Basically, if I have a raster layer consisting of discrete landcover<br>
>> values (1: water, 2: forest, 3: built-up), it seems that there is no easy<br>
>> way to style it. QGIS will assume that the data is continuous and basically<br>
>> interpolate the color between each value, which leads to the following<br>
>> issues:<br>
>><br>
>> Let's say I want to display only water and built-up (values 1 and 3),<br>
>> water in blue and built-up in grey. QGIS will still display the forests,<br>
>> using a color somewhere "between" blue and grey. My only left option is to<br>
>> process the raster to actually replace all the 2 with NoData, which is<br>
>> highly unpractical...<br>
>><br>
>> Same if I have a boolean raster (only 0 and 1 values). QGIS will by<br>
>> default make a color ramp from 0 to 0.9999.<br>
>><br>
>> Also, the whole rather feels like a work-around for a missing feature.<br>
>><br>
>> I dream of a feature similar to this one from ArcGIS:<br>
>> <a href="http://resources.arcgis.com/en/help/main/10.1/index" rel="noreferrer" target="_blank">http://resources.arcgis.com/en<wbr>/help/main/10.1/index</a>.<br>
>> html#/representing_unique_cate<wbr>gories_such_as_land_use/009t00<wbr>000074000000/<br>
>> where all unique values are styled independently and where I can easily<br>
>> skip the values I don't want to see on my map.<br>
>><br>
>> I asked a question here:<br>
>> <a href="http://gis.stackexchange.com/questions/194116/qgis-style-a-d" rel="noreferrer" target="_blank">http://gis.stackexchange.com/q<wbr>uestions/194116/qgis-style-a-d</a><br>
>> iscrete-raster<br>
>><br>
>> and opened a ticket here:<br>
>> <a href="http://hub.qgis.org/issues/14845" rel="noreferrer" target="_blank">http://hub.qgis.org/issues/148<wbr>45</a><br>
>><br>
>> But none has gotten lots of attention yet... Am I the only one to be<br>
>> annoyed by this? If no, please raise your hand and let's try to get some<br>
>> momentum and see how to push this feature forward!<br>
>><br>
>> Thanks a lot in advance!<br>
>><br>
>> Cheers<br>
>><br>
>> Stéphane<br>
>><br>
>><br>
><br>
<br>
--<br>
Stéphane Henriod<br>
CIM-Expert for GIS and Green Economy Statistics<br>
<br>
Национальный статистический комитет Кыргызской Республики<br>
Кыргыз Республикасынын Улуттук статистика комитети<br>
National Statistical Committee of the Kyrgyz Republic<br>
<br>
374 Фрунзе ул. / Frunze str.<br>
720033 Бишкек / Bishkek<br>
<br>
T   +996 778 46 99 02 (KG)<br>
T   +49 176 280 11 050 (DE)<br>
E    <a href="javascript:_e(%7B%7D,'cvml','s@henriod.info');" target="_blank">s@henriod.info</a><br>
W   <a href="http://www.stat.kg" rel="noreferrer" target="_blank">http://www.stat.kg</a><br>
W3W: nightfall.into.bucket<br>
<<a href="https://map.what3words.com/nightfall.into.bucket" rel="noreferrer" target="_blank">https://map.what3words.com/ni<wbr>ghtfall.into.bucket</a>>  //  запас.союз.дружный<br>
<<a href="https://map.what3words.com/" rel="noreferrer" target="_blank">https://map.what3words.com/</a>за<wbr>пас.союз.дружный><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.osgeo.org/pipermail/qgis-user/attachments/20170109/985fd14c/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.osgeo.org/piperm<wbr>ail/qgis-user/attachments/<wbr>20170109/985fd14c/attachment-<wbr>0001.html</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: landcover.zip<br>
Type: application/zip<br>
Size: 2151 bytes<br>
Desc: not available<br>
URL: <<a href="http://lists.osgeo.org/pipermail/qgis-user/attachments/20170109/985fd14c/attachment-0001.zip" rel="noreferrer" target="_blank">http://lists.osgeo.org/piperm<wbr>ail/qgis-user/attachments/<wbr>20170109/985fd14c/attachment-<wbr>0001.zip</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
______________________________<wbr>_________________<br>
Qgis-user mailing list<br>
<a href="javascript:_e(%7B%7D,'cvml','Qgis-user@lists.osgeo.org');" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-user</a><br>
Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-user</a><br>
<br>
------------------------------<br>
<br>
End of Qgis-user Digest, Vol 131, Issue 13<br>
******************************<wbr>************<br>
</blockquote></div><br></div></div></div></div></div></div></div></div>
</blockquote></div><br><br>-- <br><div dir="ltr"><div><font face="arial, helvetica, sans-serif" size="2">Stéphane Henriod</font></div><div><font face="arial, helvetica, sans-serif" size="2">CIM-Expert for GIS and Green Economy Statistics</font></div><div><font face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font face="arial, helvetica, sans-serif" size="2">Национальный статистический комитет Кыргызской Республики</font></div><div><font face="arial, helvetica, sans-serif" size="2">Кыргыз Республикасынын Улуттук статистика комитети</font></div><div><font face="arial, helvetica, sans-serif" size="2">National Statistical Committee of the Kyrgyz Republic</font></div><div><font face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font face="arial, helvetica, sans-serif" size="2">374 Фрунзе ул. / Frunze str.</font></div><div><font face="arial, helvetica, sans-serif" size="2">720033 Бишкек / Bishkek</font></div><div><font face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font face="arial, helvetica, sans-serif" size="2">T   +996 778 46 99 02 (KG)</font></div><div><font face="arial, helvetica, sans-serif" size="2">T   +49 176 280 11 050 (DE)</font></div><div><font face="arial, helvetica, sans-serif" size="2">E    <a href="mailto:s@henriod.info" target="_blank">s@henriod.info</a></font></div><div><font face="arial, helvetica, sans-serif" size="2">W   <a href="http://www.stat.kg" target="_blank">http://www.stat.kg</a></font></div><div><font face="arial, helvetica, sans-serif" size="2">W3W: <a href="https://map.what3words.com/nightfall.into.bucket" target="_blank">nightfall.into.bucket</a>  //  <a href="https://map.what3words.com/запас.союз.дружный" target="_blank">запас.союз.дружный</a></font></div></div><br>