[Qgis-user] Symbolizing a discrete or a boolean raster (Stéphane Henriod)

Nyall Dawson nyall.dawson at gmail.com
Wed Jan 11 16:41:48 PST 2017


On 12 January 2017 at 04:59, Alexandre Neto <senhor.neto at gmail.com> wrote:
> I will share my opinion as I did in the developers list.
>
> We users are as responsible for QGIS development as the developers. So
> rather than asking what QGIS can do for us, maybe we should think what we
> can do for QGIS. Don't just wait that a volunteer developer decide to spend
> his free time developing a tool that you need.
>
> IMHO, since it seems that you are not able/willing to sponsor the feature
> yourself, sounds like a good opportunity for a small crowdfunding.
>
> That way you would be able to contribute back to QGIS by giving your time in
> finding a developer able to do it, setting up the crowdfunding, advertise
> it, pay for part of it and so on.
>
> It looks like a simple feature. It should not be very expensive (much less
> than an ArcGIS license for sure), and if you think many people need this,
> then the money will be easy to raise. And there is still time to introduce
> this before QGIS 3.0.

Just to add to this - you may find the writeup at
http://nyalldawson.net/2016/08/how-to-effectively-get-things-changed-in-qgis/
useful as a summary of the different approaches you can take to get
this feature implemented.

What you've done so far is a perfect first step - determining that
there's high demand and lots of interest in your feature!

Nyall



>
> Best regards,
> Alexandre Neto
>
>
> A qua, 11/01/2017, 14:55, Stéphane Henriod <s at henriod.info> escreveu:
>>
>> Thanks for checking, that's what I realized as well!
>>
>> Do you know if there is still a chance to include it for 3.0 or is it too
>> late already?
>>
>> Cheers
>>
>> Stéphane
>>
>>
>> Le mercredi 11 janvier 2017, DelazJ <delazj at gmail.com> a écrit :
>>>
>>> Hi Stéphane,
>>>
>>> I gave it a look and I'm sorry I was wrong. There have been some work on
>>> the raster classification but it was rather about color and extent
>>> management. See
>>> https://github.com/qgis/QGIS/pulls?utf8=%E2%9C%93&q=is%3Apr%20discrete%20is%3Aclosed%20
>>> or
>>> https://github.com/qgis/QGIS/pulls?utf8=%E2%9C%93&q=is%3Apr%20pseudocolor%20is%3Aclosed%20
>>> but testing upcoming 3.0 shows that nothing has changed in the area you are
>>> interested in.
>>>
>>> Harrissou
>>>
>>> 2017-01-11 4:37 GMT+01:00 Stéphane Henriod <s at henriod.info>:
>>>>
>>>> Hi Harrissou
>>>>
>>>> is there any description / documentation of the work that has been done
>>>> on this (feature description, etc.)? If yes, I'd like to have a look and
>>>> maybe
>>>>
>>>> Thanks a lot!
>>>>
>>>> Stéphane
>>>>
>>>>
>>>> Le mardi 10 janvier 2017, DelazJ <delazj at gmail.com> a écrit :
>>>>>
>>>>> Hi Stéphane,
>>>>>
>>>>> 2017-01-10 4:02 GMT+01:00 Stéphane Henriod <s at henriod.info>:
>>>>>>
>>>>>> Hi Chris
>>>>>> this is very nice! I indeed didn't know this trick and will certainly
>>>>>> use it again in the future!
>>>>>>
>>>>>> However... :-)
>>>>>>
>>>>>> 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)!
>>>>>>
>>>>>> Since the user can style continuous rasters with some
>>>>>> "button-clicking", I believe the same option should be available for
>>>>>> discrete rasters as well.
>>>>>>
>>>>>> 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)
>>>>>>
>>>>> There have been some work done in the raster properties dialog in the
>>>>> upcoming 3.0. I don't know if your concern was covered though.
>>>>> If you want, you can move the question to the developer's list and
>>>>> discuss whether/how this can be implemented (and its requirements).
>>>>>
>>>>> Regards,
>>>>> Harrissou
>>>>>
>>>>>> Thanks again and cheers!
>>>>>>
>>>>>> Stéphane
>>>>>>
>>>>>>
>>>>>> Le mardi 10 janvier 2017, Chris House <housec01 at gmail.com> a écrit :
>>>>>>>
>>>>>>> Hi Stéphane,
>>>>>>>
>>>>>>> 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.
>>>>>>>
>>>>>>> save the spreadsheet as a csv and change the extension to .txt
>>>>>>> instead of .csv.
>>>>>>>
>>>>>>> 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.
>>>>>>>
>>>>>>> # QGIS Generated Color Map Export File
>>>>>>> INTERPOLATION:EXACT
>>>>>>> -9999,0,0,0,255,NoData
>>>>>>> 0,176,176,176,255,Non-Forested
>>>>>>> 15,234,255,191,255,10 <=  CC < 20
>>>>>>> 25,187,230,149,255,20 <=  CC < 30
>>>>>>> 35,140,201,109,255,30 <=  CC < 40
>>>>>>> 45,98,176,74,255,40 <=  CC < 50
>>>>>>> 55,59,153,43,255,50 <= CC < 60
>>>>>>> 65,0,128,0,255,60 <=  CC < 70
>>>>>>> 75,15,92,11,255,70 <=  CC < 80
>>>>>>> 85,17,61,12,255,80 <=  CC < 90
>>>>>>> 95,16,36,12,255,90 <=  CC <= 100
>>>>>>>
>>>>>>> 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.
>>>>>>>
>>>>>>> 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.
>>>>>>>
>>>>>>> --Chris
>>>>>>>
>>>>>>> On Mon, Jan 9, 2017 at 3:00 PM, <qgis-user-request at lists.osgeo.org>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Send Qgis-user mailing list submissions to
>>>>>>>>         qgis-user at lists.osgeo.org
>>>>>>>>
>>>>>>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>>>>>>         http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>>>>>> or, via email, send a message with subject or body 'help' to
>>>>>>>>         qgis-user-request at lists.osgeo.org
>>>>>>>>
>>>>>>>> You can reach the person managing the list at
>>>>>>>>         qgis-user-owner at lists.osgeo.org
>>>>>>>>
>>>>>>>> When replying, please edit your Subject line so it is more specific
>>>>>>>> than "Re: Contents of Qgis-user digest..."
>>>>>>>>
>>>>>>>>
>>>>>>>> Today's Topics:
>>>>>>>>
>>>>>>>>    1. Re: Symbolizing a discrete or a boolean raster (Stéphane
>>>>>>>> Henriod)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ----------------------------------------------------------------------
>>>>>>>>
>>>>>>>> Message: 1
>>>>>>>> Date: Mon, 9 Jan 2017 23:07:36 +0600
>>>>>>>> From: Stéphane Henriod <s at henriod.info>
>>>>>>>> To: Enrico Fiore <enricofiore at libero.it>
>>>>>>>> Cc: qgis-user <qgis-user at lists.osgeo.org>
>>>>>>>> Subject: Re: [Qgis-user] Symbolizing a discrete or a boolean raster
>>>>>>>> Message-ID:
>>>>>>>>
>>>>>>>> <CAK6pVBXURm_e7dRP+8SP9amPUUX0+Cn3GVxLPNjOHhno85o2rA at mail.gmail.com>
>>>>>>>> Content-Type: text/plain; charset="utf-8"
>>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> thanks for following up!
>>>>>>>>
>>>>>>>> It actually does part of the job!
>>>>>>>>
>>>>>>>> Using *Color interpretation: Exact*, I can indeed input the exact
>>>>>>>> values I
>>>>>>>> want to display (1,5 and 10) and all other pixels are hidden.
>>>>>>>>
>>>>>>>> HOWEVER,
>>>>>>>>
>>>>>>>> this still feels like a workaround:
>>>>>>>>
>>>>>>>>    - In the case of a discrete raster with many (> 50) unique
>>>>>>>> values, I do
>>>>>>>>    not want to input all of them manually
>>>>>>>>    - In some cases, I do not know in advance all the unique values
>>>>>>>> of my
>>>>>>>>    raster
>>>>>>>>    - If I click on *Classify*, QGIS will choose X values (based on
>>>>>>>> the
>>>>>>>>    number of classes and the classification method (continuous or
>>>>>>>> equal
>>>>>>>>    interval)), which no longer match the "exact" values of my
>>>>>>>> raster. It
>>>>>>>>    doesn't really make sense to classify a discrete rendering
>>>>>>>>
>>>>>>>> So I would say, we still need a render type "discrete raster" which
>>>>>>>> offers
>>>>>>>> the function to "retrieve all unique values" (and automatically
>>>>>>>> apply a
>>>>>>>> discrete color ramp)
>>>>>>>>
>>>>>>>> Attached a (fake) test dataset.
>>>>>>>>
>>>>>>>> Thanks and cheers
>>>>>>>>
>>>>>>>> Stéphane
>>>>>>>>
>>>>>>>>
>>>>>>>> Le lundi 9 janvier 2017, Enrico Fiore <enricofiore at libero.it> a
>>>>>>>> écrit :
>>>>>>>>
>>>>>>>> > Hi,
>>>>>>>> > Sorry I can't do test, but if you use exact in color interpolation
>>>>>>>> > parameter?
>>>>>>>> >
>>>>>>>> > Cheers
>>>>>>>> >
>>>>>>>> > Enrico
>>>>>>>>
>>>>>>>>
>>>>>>>> Le lundi 9 janvier 2017, Stéphane Henriod <s at henriod.info> a écrit :
>>>>>>>>
>>>>>>>> > Hi
>>>>>>>> >
>>>>>>>> > unfortunately this is doing quite something different!
>>>>>>>> >
>>>>>>>> > If I have a raster with 10 Landcover classes
>>>>>>>> > (1,2,3,4,5,6,7,8,9,10) and I
>>>>>>>> > want to display only 1,5 and 10, using *Discrete *(1: red, 5:
>>>>>>>> > yellow, 10:
>>>>>>>> > blue) the following will happen:
>>>>>>>> >
>>>>>>>> > All pixels between 1 and 4 will be red
>>>>>>>> > All pixels between 5 and 9 will be yellow
>>>>>>>> > All pixels with 10 will be blue
>>>>>>>> >
>>>>>>>> > In this sense, the pixels are indeed not interpolated, but this
>>>>>>>> > still is
>>>>>>>> > not the behavior I am expecting when styling discrete rasters.
>>>>>>>> >
>>>>>>>> > A "style discrete raster" function should offer the following:
>>>>>>>> >
>>>>>>>> >    - Automatically recover all unique values from the raster
>>>>>>>> >    - Only display the pixels to which the user has explicitly
>>>>>>>> > assigned a
>>>>>>>> >    color
>>>>>>>> >
>>>>>>>> > But thanks for your hint, this can be helpful in other cases!
>>>>>>>> >
>>>>>>>> > Cheers
>>>>>>>> >
>>>>>>>> > Stéphane
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > Le lundi 9 janvier 2017, Enrico Fiore <enricofiore at libero.it
>>>>>>>> > <javascript:_e(%7B%7D,'cvml','enricofiore at libero.it');>> a écrit :
>>>>>>>> >
>>>>>>>> >> Hi,
>>>>>>>> >> I think that the solution is in the QGIS documentation, that you
>>>>>>>> >> can read
>>>>>>>> >> here:
>>>>>>>> >> http://docs.qgis.org/2.14/en/docs/user_manual/working_with_r
>>>>>>>> >> aster/raster_properties.html#band-rendering
>>>>>>>> >> you have to use *Singleband pseudocolor *and set color
>>>>>>>> >> interpolation to
>>>>>>>> >> Discrete.
>>>>>>>> >>
>>>>>>>> >> Enrico
>>>>>>>> >>
>>>>>>>> >>
>>>>>>>> >> ----Messaggio originale----
>>>>>>>> >> Da: "Stéphane Henriod" <s at henriod.info>
>>>>>>>> >> Data: 09/01/2017 6.30
>>>>>>>> >> A: "qgis-user"<qgis-user at lists.osgeo.org>
>>>>>>>> >> Ogg: [Qgis-user] Symbolizing a discrete or a boolean raster
>>>>>>>> >>
>>>>>>>> >> Dear all
>>>>>>>> >>
>>>>>>>> >> As much as I love QGIS and use it in my everyday life, there is
>>>>>>>> >> one
>>>>>>>> >> feature that I find particularly annoying: the styling of
>>>>>>>> >> discrete rasters.
>>>>>>>> >>
>>>>>>>> >> Basically, if I have a raster layer consisting of discrete
>>>>>>>> >> landcover
>>>>>>>> >> values (1: water, 2: forest, 3: built-up), it seems that there is
>>>>>>>> >> no easy
>>>>>>>> >> way to style it. QGIS will assume that the data is continuous and
>>>>>>>> >> basically
>>>>>>>> >> interpolate the color between each value, which leads to the
>>>>>>>> >> following
>>>>>>>> >> issues:
>>>>>>>> >>
>>>>>>>> >> Let's say I want to display only water and built-up (values 1 and
>>>>>>>> >> 3),
>>>>>>>> >> water in blue and built-up in grey. QGIS will still display the
>>>>>>>> >> forests,
>>>>>>>> >> using a color somewhere "between" blue and grey. My only left
>>>>>>>> >> option is to
>>>>>>>> >> process the raster to actually replace all the 2 with NoData,
>>>>>>>> >> which is
>>>>>>>> >> highly unpractical...
>>>>>>>> >>
>>>>>>>> >> Same if I have a boolean raster (only 0 and 1 values). QGIS will
>>>>>>>> >> by
>>>>>>>> >> default make a color ramp from 0 to 0.9999.
>>>>>>>> >>
>>>>>>>> >> Also, the whole rather feels like a work-around for a missing
>>>>>>>> >> feature.
>>>>>>>> >>
>>>>>>>> >> I dream of a feature similar to this one from ArcGIS:
>>>>>>>> >> http://resources.arcgis.com/en/help/main/10.1/index.
>>>>>>>> >>
>>>>>>>> >> html#/representing_unique_categories_such_as_land_use/009t00000074000000/
>>>>>>>> >> where all unique values are styled independently and where I can
>>>>>>>> >> easily
>>>>>>>> >> skip the values I don't want to see on my map.
>>>>>>>> >>
>>>>>>>> >> I asked a question here:
>>>>>>>> >> http://gis.stackexchange.com/questions/194116/qgis-style-a-d
>>>>>>>> >> iscrete-raster
>>>>>>>> >>
>>>>>>>> >> and opened a ticket here:
>>>>>>>> >> http://hub.qgis.org/issues/14845
>>>>>>>> >>
>>>>>>>> >> But none has gotten lots of attention yet... Am I the only one to
>>>>>>>> >> be
>>>>>>>> >> annoyed by this? If no, please raise your hand and let's try to
>>>>>>>> >> get some
>>>>>>>> >> momentum and see how to push this feature forward!
>>>>>>>> >>
>>>>>>>> >> Thanks a lot in advance!
>>>>>>>> >>
>>>>>>>> >> Cheers
>>>>>>>> >>
>>>>>>>> >> Stéphane
>>>>>>>> >>
>>>>>>>> >>
>>>>>>>> >
>>>>>>>>
>>>>>>>> --
>>>>>>>> Stéphane Henriod
>>>>>>>> CIM-Expert for GIS and Green Economy Statistics
>>>>>>>>
>>>>>>>> Национальный статистический комитет Кыргызской Республики
>>>>>>>> Кыргыз Республикасынын Улуттук статистика комитети
>>>>>>>> National Statistical Committee of the Kyrgyz Republic
>>>>>>>>
>>>>>>>> 374 Фрунзе ул. / Frunze str.
>>>>>>>> 720033 Бишкек / Bishkek
>>>>>>>>
>>>>>>>> T   +996 778 46 99 02 (KG)
>>>>>>>> T   +49 176 280 11 050 (DE)
>>>>>>>> E    s at henriod.info
>>>>>>>> W   http://www.stat.kg
>>>>>>>> W3W: nightfall.into.bucket
>>>>>>>> <https://map.what3words.com/nightfall.into.bucket>  //
>>>>>>>> запас.союз.дружный
>>>>>>>> <https://map.what3words.com/запас.союз.дружный>
>>>>>>>> -------------- next part --------------
>>>>>>>> An HTML attachment was scrubbed...
>>>>>>>> URL:
>>>>>>>> <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170109/985fd14c/attachment-0001.html>
>>>>>>>> -------------- next part --------------
>>>>>>>> A non-text attachment was scrubbed...
>>>>>>>> Name: landcover.zip
>>>>>>>> Type: application/zip
>>>>>>>> Size: 2151 bytes
>>>>>>>> Desc: not available
>>>>>>>> URL:
>>>>>>>> <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170109/985fd14c/attachment-0001.zip>
>>>>>>>>
>>>>>>>> ------------------------------
>>>>>>>>
>>>>>>>> Subject: Digest Footer
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Qgis-user mailing list
>>>>>>>> Qgis-user at lists.osgeo.org
>>>>>>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>>>>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>>>>>>
>>>>>>>> ------------------------------
>>>>>>>>
>>>>>>>> End of Qgis-user Digest, Vol 131, Issue 13
>>>>>>>> ******************************************
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Stéphane Henriod
>>>>>> CIM-Expert for GIS and Green Economy Statistics
>>>>>>
>>>>>> Национальный статистический комитет Кыргызской Республики
>>>>>> Кыргыз Республикасынын Улуттук статистика комитети
>>>>>> National Statistical Committee of the Kyrgyz Republic
>>>>>>
>>>>>> 374 Фрунзе ул. / Frunze str.
>>>>>> 720033 Бишкек / Bishkek
>>>>>>
>>>>>> T   +996 778 46 99 02 (KG)
>>>>>> T   +49 176 280 11 050 (DE)
>>>>>> E    s at henriod.info
>>>>>> W   http://www.stat.kg
>>>>>> W3W: nightfall.into.bucket  //  запас.союз.дружный
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Qgis-user mailing list
>>>>>> Qgis-user at lists.osgeo.org
>>>>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Stéphane Henriod
>>>> CIM-Expert for GIS and Green Economy Statistics
>>>>
>>>> Национальный статистический комитет Кыргызской Республики
>>>> Кыргыз Республикасынын Улуттук статистика комитети
>>>> National Statistical Committee of the Kyrgyz Republic
>>>>
>>>> 374 Фрунзе ул. / Frunze str.
>>>> 720033 Бишкек / Bishkek
>>>>
>>>> T   +996 778 46 99 02 (KG)
>>>> T   +49 176 280 11 050 (DE)
>>>> E    s at henriod.info
>>>> W   http://www.stat.kg
>>>> W3W: nightfall.into.bucket  //  запас.союз.дружный
>>>>
>>>>
>>>
>>
>>
>> --
>> Stéphane Henriod
>> CIM-Expert for GIS and Green Economy Statistics
>>
>> Национальный статистический комитет Кыргызской Республики
>> Кыргыз Республикасынын Улуттук статистика комитети
>> National Statistical Committee of the Kyrgyz Republic
>>
>> 374 Фрунзе ул. / Frunze str.
>> 720033 Бишкек / Bishkek
>>
>> T   +996 778 46 99 02 (KG)
>> T   +49 176 280 11 050 (DE)
>> E    s at henriod.info
>> W   http://www.stat.kg
>> W3W: nightfall.into.bucket  //  запас.союз.дружный
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> --
> Alexandre Neto
> ---------------------
> @AlexNetoGeo
> http://sigsemgrilhetas.wordpress.com
> http://gisunchained.wordpress.com
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user



More information about the Qgis-user mailing list