Hexagon Geospatial

Spatial Modeler

Discuss topics with other Hexagon Geospatial Product pioneers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Posts: 59
Registered: ‎04-19-2016

Trouble with simple "EITHER OR" two image analysis

[ Edited ]

Hi there, I have a very simple model, but have no idea where I am going wrong! I have a coudy Landsat image, and a cloud mask. The Landsat 9 image is unsigned 16-bit 7 band image, and the cloud mask is a thematic layer (Value = 0 for cloud affected areas; Value = 1 for cloud free areas) My model simple multiplies the outputs together to convert the cloud affected Landsat pixels to zero, and retain the original raster values in cloud free areas of the mask. However, my result is a dataset of zero where the clouds were, but values 65535 instead of the original landsat values??? Where am I going wrong? PS. How do I attach a picture when I post a message?

Posts: 552
Registered: ‎02-02-2016

Re: Trouble with simple "EITHER OR" two image analysis

Hello Jens,


You can attach an image to your post using the “Insert/edit image” icon on the toolbar at the top of the text box. It is the ninth icon from the left - outlined in red in the image below.



I have posted two images of spatial models which will accomplish the task you want to perform. The first one uses the multiplication method you mentioned and the second one uses a conditional Either/Or operator.








You may also be interested our spatial model Simple Cloud Mask for Landsat Imagery found in the ERDAS IMAGINE Spatial Recipes section of the Community.




Stephen Bent

Hexagon Geospatial Support





Posts: 59
Registered: ‎04-19-2016

Re: Trouble with simple "EITHER OR" two image analysis

Hi Stephen,


Thanks for your response!


That "insert image" brings up a dialog that asks for a image source, description and dimensions, and has no way of browsing my pc to insert an image. Not too familiar with html source code to quickly write a bit of code just for an image upload?




I actually solved the issue in the modeler. I am familiar with the EitherOr and Multiply queries, and that is why I was puzzled by the result I got from the model.


It strangely required a "Replace NoData With" operator after the thematic raster input to at last give the result I needed.


Not sure if this is a bug, or a new common best practice when using the new modeler?





Occasional Contributor
Posts: 8
Registered: ‎05-01-2018

Re: Trouble with simple "EITHER OR" two image analysis

I'm trying to do something similar, but using the Landsat pixel_qa band to identify the cloud pixels, and then reset my NDVI values as NoData if they are clouds, but otherwise leave them untouched.  Normally, this will take care of the out-of-range NDVI values that are calculated from a scene which has a few clouds in it............

I think this must require a combination of the Either/Or operator, and the Set NoData operator, but I'm having trouble, from the model above and the IMAGINE Help files figuring out how to write the expression within either of these operators.  In ArcGIS this is easy to do in the Raster Calculator, but I don't see a similar tool in IMAGINE. I have included  the pixel_qa band in my layer stack.


Any suggestions or pointers appreciated (I have looked at the "Simple cloud mask" model, but don't find it simple at all, and think that I may as well use the USGS qa band since that's what its for......




Technical Evangelist
Posts: 640
Registered: ‎10-01-2015

Re: Trouble with simple "EITHER OR" two image analysis

Hi All,


If you have NoData locations the output will always be NoData. So if you want an actual evaluation to take place at those locations and a different value be output, you will need to perform a Replace NoData With first (and pick a replacement value that you can keep track of and include in your conditional evaluations).


There's a protracted discussion on NoData handling (with links to other related topics) here:






Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Please register to vote
Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.