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
Technical Evangelist
Posts: 64
Registered: ‎04-12-2016
Accepted Solution

How to create a model to select images and then Export to GeoTiff

Hi,

 

Does anyone know if its possible to create a model to allow the user to select an image and then do an Export to GeoTIFF, defining the output name for the image? The ideal situation would be to be able to select multiple images, but if it has to be one by one it will fit the request also.

 

A second situation (version of the model) would be to clip the image based on a vectorial limit, before the output. Is there any operator to do that?

 

If any of this is possible, how to do it?

 

Tks,

 

NA

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

Re: How to create a model to select images and then Export to GeoTiff

Hi NA,

 

Yes, all of that is possible and easy in Spatial Modeler. Check out this example in the Spatial Modeler Tutorials section for vector-based subsetting:

 

https://community.hexagongeospatial.com/t5/Spatial-Modeler-Tutorials/Subset-Image-by-Polygonal-Geome...

 

Raster Output supports a number of formats to write directly, including TIFF.

 

Cheers

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Technical Evangelist
Posts: 64
Registered: ‎04-12-2016

Re: How to create a model to select images and then Export to GeoTiff

Hi Ian,

 

I'll explore the model.

 

thanks for the info.

 

Nuno

Technical Evangelist
Posts: 64
Registered: ‎04-12-2016

Re: How to create a model to select images and then Export to GeoTiff

Hi Ian,

 

I'm using the model, and it clips and export the result perfectly.

 

The question is that I'm using binary images, and the part of the mbr image that is outside of the clipped area is all in black, as you can see in the attached image.

 

Since the images are in black and white I can't change the foreground color in GeoMedia to a different one than black, but I can't have the rest of the image, outside the AOI, in black.

 

Is there any way to solve this? 

 

TIA

 

Regards,

 

Nuno

Technical Evangelist
Posts: 64
Registered: ‎04-12-2016

Re: How to create a model to select images and then Export to GeoTiff

Hi,

 

 

After doing some tests in Spatial Model Editor, using the preview window, I can see that if I:

  • Change the File Type of the Raster Output to 'Continuous';
  • In the 'Image Chain' command, change the from Panchromatic to Pseudocolor
  • In the 'Color Table' command, select a color

 

... I get a resulting image that solves this issue.

 

My question is: how do I include the operations of the 2nd and the 3rd bullet in the Model?

 

Thanks,

 

Nuno 

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

Re: How to create a model to select images and then Export to GeoTiff

The Preview is persisting the NoData mask and so you’ll need an output format which also persists it. Which unfortunately means, if I recall correctly, you’ll need to wait for the 2019 releases later this year to have that type of TIFF supported by Spatial Modeler. 

 

The other alternative to try would be to go 2-bit and code the data 0 for background (outside the AOI), 1 for black line work and 2 for white paper (or vice versa). There are several examples in Spatial Modeler Tutorials showing you how to attach Colour and opacity attributes to the class values you use. 

 

Hope that helps. 

 

Cheers

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Technical Evangelist
Posts: 64
Registered: ‎04-12-2016

Re: How to create a model to select images and then Export to GeoTiff

Hi Ian,

 

Could you reference one tutorial that has this kind of situation?

 

I'll need to do a recode of the colors, but my main question (that I don't know if is explained in the tutorials), is how do I specify that I want to assign a value to one color, but just outside the AOI.

 

If you have an idea of a tutorial that has this situation I would appreciate.

 

Thanks a lot for your help.

 

Nuno

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

Re: How to create a model to select images and then Export to GeoTiff

Hi Nuno,

 

Back from vacation and catching up with a few things.

 

Example of attaching colour attributes:

 

https://community.hexagongeospatial.com/t5/Spatial-Modeler-Tutorials/Attach-Standardised-Class-Names...

 

For converting from 1-bit to 2-bit here's what I'd do: Add 1 to your original data, so 0s and 1s become 1s and 2s (and the NoData mask remains a NoData mask) and then use the Replace NoData With operator to convert the NoData mask to values of 0. Now you have 0s (the area beyond your clipping AOI), 1s and 2s (black linework and white paper, depending on which way round they were originally encoded). Attach Color and Opacity attributes to these as appropriate and then send to GeoTIFF in Raster Output. You may need to use the Set Thematicity operator as well to make sure the data is being defined as thematic (rather than athematic / continuous).

 

Cheers

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Technical Evangelist
Posts: 64
Registered: ‎04-12-2016

Re: How to create a model to select images and then Export to GeoTiff

 

Hi Ian,

 

How do I do the first step: "Add 1 to your original data, so 0s and 1s become 1s and 2s”. 

 

TIA,

 

Nuno

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

Re: How to create a model to select images and then Export to GeoTiff

The Add operator. Specify one of the input ports as "1" and the other as the raster stream.

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