[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qgis-user
Subject:    Re: [Qgis-user] Raster Calculator Expression to determine color
From:       Nick Papadonis <npapadonis () gmail ! com>
Date:       2015-07-31 1:56:24
Message-ID: D3B07492-EEB4-47A3-8662-814EA7B0E2F2 () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On Jul 30, 2015, at 9:29 PM, Nyall Dawson <nyall.dawson@gmail.com> wrote:
> On 31 Jul 2015 11:07 am, "Nick Papadonis" <npapadonis@gmail.com \
> <mailto:npapadonis@gmail.com>> wrote:
> > 
> > HI Folks,
> > 
> > I'm trying to use the following expression to pick up the red colored routes on a \
> > map in which I used the info pointer tool to get the band values for the color. 
> > ("m@1" < 238 AND "m@1" > 213 AND "m@2" < 123 AND "m@2" > 98 AND "m@3" < 125 AND \
> > "m@3" < 99) * 1
> 
> Should that last check be "m@3" > 99?
> 
> 

I corrected above to:
("m@1" < 238 AND "m@1" > 213 AND "m@2" < 123 AND "m@2" > 98 AND "m@3" < 125 AND "m@3" \
> 99) * 1

with the same results which is black output tiff.

I then tried individual expressions for each band as separate steps (sanity check):
("m@1" < 238 AND "m@1" > 213) * 1
("m@2" < 123 AND "m@2" > 98) * 1
("m@3" < 125 AND "m@3" > 99) * 1

These all produce a masked image, however masked incorrectly because I'm evaluating \
only a single band in the Raster Calculator.

When I combine evaluation of bands as above or below to pick pixels in color range:

 (("m@1" < 238 AND "m@1" > 210) AND ("m@2" < 123 AND "m@2" > 94) AND ("m@3" < 130 AND \
"m@3" > 98)) * 1

I get a black image with no matches.  I expected at least one pixel identified using \
this expression because I evaluate a pixel at 224, 108, 115 and there are many other \
pixels in above range.

Does anyone know if my expression needs correction or the Raster Calculator can only \
evaluate a single band in the expression?

Thanks again,
Nick

> Nyall
> 
> > 
> > Unfortunately, when this expression is used the resulting map is black with no \
> > other pixels for the detected color. 
> > If I break down this expression to a simple "greater than" line for single band, \
> > then things work. 
> > Does anyone know where this expression needs to be corrected?
> > 
> > Thanks again,
> > Nick
> > _______________________________________________
> > Qgis-user mailing list
> > Qgis-user@lists.osgeo.org <mailto:Qgis-user@lists.osgeo.org>
> > http://lists.osgeo.org/mailman/listinfo/qgis-user \
> > <http://lists.osgeo.org/mailman/listinfo/qgis-user>


[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html \
charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote \
type="cite" class=""><div class="">On Jul 30, 2015, at 9:29 PM, Nyall Dawson &lt;<a \
href="mailto:nyall.dawson@gmail.com" class="">nyall.dawson@gmail.com</a>&gt; \
wrote:</div><div class=""><p dir="ltr" class="">On 31 Jul 2015 11:07 am, "Nick \
Papadonis" &lt;<a href="mailto:npapadonis@gmail.com" \
class="">npapadonis@gmail.com</a>&gt; wrote:<br class=""> &gt;<br class="">
&gt; HI Folks,<br class="">
&gt;<br class="">
&gt; I'm trying to use the following expression to pick up the red colored routes on \
a map in which I used the info pointer tool to get the band values for the color.<br \
class=""> &gt;<br class="">
&gt; ("m@1" &lt; 238 AND "m@1" &gt; 213 AND "m@2" &lt; 123 AND "m@2" &gt; 98 AND \
"m@3" &lt; 125 AND "m@3" &lt; 99) * 1</p><p dir="ltr" class="">Should that last check \
be "m@3" &gt; 99?</p><div class=""><br class=""></div></div></blockquote><div><br \
class=""></div><div>I corrected above to:</div><div>("m@1" &lt; 238 AND "m@1" &gt; \
213 AND "m@2" &lt; 123 AND "m@2" &gt; 98 AND "m@3" &lt; 125 AND "m@3" &gt; 99) * \
1</div><div><br class=""></div><div>with the same results which is black output \
tiff.</div><div><br class=""></div><div>I then tried individual expressions for each \
band as separate steps (sanity check):</div><div>("m@1" &lt; 238 AND "m@1" &gt; 213) \
* 1</div><div>("m@2" &lt; 123 AND "m@2" &gt; 98) * 1</div><div>("m@3" &lt; 125 AND \
"m@3" &gt; 99) * 1</div><div><br class=""></div><div>These all produce a masked \
image, however masked incorrectly because I'm evaluating only a single band in the \
Raster Calculator.</div><div><br class=""></div><div>When I combine evaluation of \
bands as above or below to pick pixels in color range:</div><div><br \
class=""></div>&nbsp;(("m@1" &lt; 238 AND "m@1" &gt; 210) AND ("m@2" &lt; 123 AND \
"m@2" &gt; 94) AND ("m@3" &lt; 130 AND "m@3" &gt; 98)) * 1</div><div><br \
class=""></div><div>I get a black image with no matches. &nbsp;I expected at least \
one pixel identified using this expression because I evaluate a pixel at 224, 108, \
115 and there are many other pixels in above range.</div><div><br \
class=""></div><div>Does anyone know if my expression needs correction or the Raster \
Calculator can only evaluate a single band in the expression?</div><div><br \
class=""></div><div>Thanks again,</div><div>Nick</div><div><br class=""><blockquote \
type="cite" class=""><div class=""><p dir="ltr" class="">Nyall</p><p dir="ltr" \
class="">&gt;<br class=""> &gt; Unfortunately, when this expression is used the \
resulting map is black with no other pixels for the detected color.<br class=""> \
&gt;<br class=""> &gt; If I break down this expression to a simple "greater than" \
line for single band, then things work.<br class=""> &gt;<br class="">
&gt; Does anyone know where this expression needs to be corrected?<br class="">
&gt;<br class="">
&gt; Thanks again,<br class="">
&gt; Nick<br class="">
&gt; _______________________________________________<br class="">
&gt; Qgis-user mailing list<br class="">
&gt; <a href="mailto:Qgis-user@lists.osgeo.org" \
class="">Qgis-user@lists.osgeo.org</a><br class=""> &gt; <a \
href="http://lists.osgeo.org/mailman/listinfo/qgis-user" \
class="">http://lists.osgeo.org/mailman/listinfo/qgis-user</a></p> \
</div></blockquote></div><br class=""></body></html>



_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic