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
Frequent Contributor
Posts: 110
Registered: ‎11-10-2015

Spatial queries on raster input

Hi all,

 

I have a folder containing all the customer raster files, and the goal is to use a collection of areas (Shapefile) to generate a new folder (one per area) containing the raster touching this area (a same input raster file can appear in different output folders)

 

I have 2 questions about it :

  • What is the best way to run Spatial Modeler on each file in the input folder? Input raster operator? Multiple FileName operator? Batch mode?
  • How to run a spatial query to get the raster file in a given area (is it necessary to generate the footprint before?)?

Regards

Benoît

Frequent Contributor
Posts: 110
Registered: ‎11-10-2015

Re: Spatial queries on raster input

Hi,

 

To spatial query on raster, I have tried :

  • The Filter by Geometries operator, but rasters can not be set as input
  • The Apply AOI operator, but it takes only .aoi files as input... Is it possible to convert Shapefiles into AOI by operators? If not, how to generate .aoi files?

 

Regards

Benoît

Frequent Contributor
Posts: 110
Registered: ‎11-10-2015

Re: Spatial queries on raster input

Hi all,

 

Sorry for the spam, but I hoped to find a solution, but I encountered a new problem. The situation is :

  • I have used a Multi FileName Input operator and an Iterator to loop on all the .jp2 files in my initial directoryProcess1.JPG
  •  In the Iterator, I use a Raster Input, and I convert one Shapefile geometry (filtered through a Filter by Attributes operator) to raster to be able to use the Apply Mask operator and extract the intersecting raster
  • I save the result using a Copy File to DIrectory operatorProcess2.JPG

The process works fine for the first files, because they are inside the mask, and the .img file is correctly created in my output directory. But an error occured when the first raster file outside the area is processed. The Apply Mask operator raises an exception

Process3.JPG

 

I have 2 questions :

  • Is it possible to manage the potential exceptions during the process? Adding tests to avoid a such error?
  • I have not found how to get other raster format than the .img as output. A temporary file is generated, this temporary file is a .img file, and I get .img file as output named as the temporary file (is it possible to get the original .jp2 filename and format as output?)

Process4.JPG

 

For the images with an intersection with the ShapeFile boundary, the result is correct, and can be displayed in GM Desktop without any problem

Process5.JPG

 

Regards,

Benoît

Staff
Posts: 127
Registered: ‎07-04-2016

Re: Spatial queries on raster input

Hi Benoît,

 

I have been working on the model for the same purpose: to subset rasters by a defined shapefile, while skipping those that do not intersect. Please find the attached model and try if it works for you.

Kind Regards,
Marina Vardovska
Hexagon Geospatial Support
Staff
Posts: 127
Registered: ‎07-04-2016

Re: Spatial queries on raster input

[ Edited ]

Forgot to mention that I have defined the directory for output files in Directory Input operator. So you need to define there your own output folder. Or if you want to save output files to the same folder as input, you can use Get Containing Directory operator. Also with the set of Cat operators you can manipulate with the file paths, names, extensions...

2019_10_09_17_16_04_Start.png

Kind Regards,
Marina Vardovska
Hexagon Geospatial Support
Highlighted
Frequent Contributor
Posts: 110
Registered: ‎11-10-2015

Re: Spatial queries on raster input

Marina,

 

Thanks for the model!!

 

I will test it and will indicate if the result is ok

 

Regards,

Benoît

Frequent Contributor
Posts: 110
Registered: ‎11-10-2015

Re: Spatial queries on raster input

Marina,

 

The model works well, but I got a crash after 10mn. I have re-run it after keeping only few input files, and it works.

 

I have monitored the ERDAS Spatial Model Editor (32bits) process in the task manager during this second execution, and I noticed that this process grows only. It starts from 1Gb and terminates to more than 2Gb. I'm afraid than during the first execution the process crashes just after this 2Gb limit (as all our 32bits processes...)

 

I have not btried to change the output raster type, I will test it tomorrow. Do you think that only change the operator where you add '_subset.img' by specifying '_subset.jp2' is the only thing to change to get .jp2 file as output? Or a conversion operator is needed?

 

Regards

Benoît 

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

Re: Spatial queries on raster input

[ Edited ]

why not try running it 64-bit (via Run in Background)?

 

Or, if you're running ERDAS IMAGINE 2018 or later, the Spatial Model Editor itself will execute 64-bit.

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Frequent Contributor
Posts: 110
Registered: ‎11-10-2015

Re: Spatial queries on raster input

Ian,

 

I have use the 'Run in Background' option but it seems to be in 32bits, here is my task manager

 

32bits.JPG

 

After 5mn of execution, I get the same message 'Not enough memory'

32bits_2.JPG

 

When the process crashes, he is at 2,8Gb

32bits_3.JPG

 

I have not Imagine 2018, I just installed GM Desktop 2018 on my machine and when you install it, you have a Spatial Model Editor 2018 installed on your machine

 

Regards,

Benoît

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

Re: Spatial queries on raster input

Ah - since GeoMedia is a 32-bit application you may only get the 32-bit version of Spatial Modeler with it.

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.