Post

2 followers Follow
0
Avatar

Clipping/subsetting in Modeler

Hi
I'm making a cut of several independent pixes with clipping tool in Focus using a layer as a mask and the extents options and separate files for each ouptut shapes check.

I need to make this process several times and I would like to do it in Modeler, and use the library CLIP, but this tool does not create an one file for each shapes. the CLIP has only the Shapes tool Boundary and I need is the extents of each shape

How can I do this in Modeler?

rafael vargas

Please sign in to leave a comment.

3 comments

1
Avatar

Hi Rafael,
The easiest way to do this would be to create a python or EASI script to run CLIP. There is an option within CLIP to use a vector segment as the clipping layer and automatically save a separate output file for each shape. This option is only available in python and EASI scripting. I’ve included a python example below:

from pci.clip import clip

clip(fili=r"I:\Data\Test\irvine.pix", #input file
     dbic=[2], #channel(s) of input file you want to clip
     filo=r"I:\Data\Test\clip\clip.pix", #location for output files
     clipmeth="LAYERVEC_FILES", #Clipping method
     clipfil=r"I:\Data\Test\clip\clipfile.pix", #File with vectors used for clipping
     cliplay=[2], #Vector layer in clipfil
     laybnds="SHAPES") #Boundaries used in clipping

Hope this helps,
Sarah

PCI Geomatics 1 vote
0
Avatar

Sarah thanks for you anwer
I have two questions about this

the first is, if the cut does the limit of each polygon or exported by each polygon extents? I need it by the extent
and second, I have PCI 2013, this version has Python?

rafael vargas 0 votes
0
Avatar

Hi Rafael,
When you are clipping a image from a polygon the actual image data will be clipped to the polygon. However, there will be 0 values around the image data to the full (rectangular) extents of the shape. You can set the 0 values to no data values in the metadata if you do not want the black area to appear:
1. In Focus Files tab right click the pix file and choose properties
2. Add a new metadata tag (+).
3. Set the name of the tag to NO_DATA_VALUE and the value to 0. Please note that the no data tag is set to improve the display of the image in focus; the actual value of the pixel in the raster always remains the same.

In answer to your second question, python is not available in Geomatica 2013 but you can use EASI (fourth icon on toolbar). An example of how to run CLIP in EASI is available from the Geomatica Help (Focus > Help > General > search for CLIP). You would then set the same parameters as were set in the python example.

PCI Geomatics 0 votes