Hexagon Geospatial
MENU

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 
Reply
Highlighted
Frequent Contributor
Posts: 99
Registered: ‎04-03-2017
Accepted Solution

Outputting a Specific Class of Pixels to a Raster

Hi, I have a raster created with machine learning in a spatial model, which consists of a few classes.

The class attribute is called Class_Names and I want to output the 'Tree' class only. Is there something similar to the Criteria operator that allows the user to filter by a specific class?

I tried Class Name to Pixel Values but I can't output this as a raster. Also, I can't use the Criteria operator as the input changes every time I run the model.

 

Thanks,

 

Josh

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

Re: Outputting a Specific Class of Pixels to a Raster

I didn't think this was going to work, but it does:

 

string.PNG

 

In my case the LULC thematic input has an attribute field called "Landuse" and one of those classes is "Lakes". In your instance you would substitute Class_Names and Tree. The output is a binary (u1) raster where 1 represents Lakes and 0 represents not-Lakes.

 

Hope that helps.

 

Cheers

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Technical Evangelist
Posts: 698
Registered: ‎10-01-2015

Re: Outputting a Specific Class of Pixels to a Raster

Note that the above model works because a raster stream within the Spatial Model can have a pixeltype of String. However you cannot create an output raster file with a pixeltype of String.

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Staff
Posts: 118
Registered: ‎07-04-2016

Re: Outputting a Specific Class of Pixels to a Raster

[ Edited ]

Hello Josh,

 

Just wanted to check on Class Name to Pixel Values operator. It can also output one specified class. Attaching model here. Model also re-adds the color of a class and opacity for the background.2018-12-14 15_41_00-Start.png

 

 

Kind Regards,
Marina Vardovska
Hexagon Geospatial Support
Frequent Contributor
Posts: 99
Registered: ‎04-03-2017

Re: Outputting a Specific Class of Pixels to a Raster

Thanks both for your replies. I tried Ian's solution and it worked.

 

Regards,

 

Josh

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.