Post

2 followers Follow
0
Avatar

VIMAGE export

Good day, I'm trying to export statistics from the vector layer of a file list, the file list contains 10 images with NDVI of different dates, I need to generate 10 vectorial layers from a single file that contains the information.

A process in python, batch processing

Jerson Andres Achicanoy

Official comment

Avatar

Hello Jerson, 

If you would like to run VIMAGE on a number of images (i.e. multiple rasters and vectors) you would need to implement a batch script. An example of a batch python script is outlined in this tutorial: https://support.pcigeomatics.com/hc/en-us/articles/207707003-Creating-a-Batch-Workflow-Pansharpening- . This tutorial include the Pansharp function but you could also run a similar script with VIMAGE. If you are encountering a specific problem in the script you can contact support@pcigeomatics.com.

Please note that the Developer Zone includes many tutorials, videos and example scripts to help users with developing python scripts with Geomatica: http://dev.pcigeomatics.com/developer-zone 

PCI Geomatics

Please sign in to leave a comment.

2 comments

0
Avatar

Thanks, in addition I do not know how it could generate new files in the output folder with the names of the input list and that contains the information of VIMAGE, please help

The script marks error

from pci.vimage import *
from pci.exceptions import *
import os
import fnmatch

# Set the working directory
working_dir = r'E:\Base_Corregistro\Script\Indices_PY\IMG'
filv_dir = "E:\Base_Corregistro\Script\Indices_PY\ESTABILIDAD.pix"
output_dir = os.path.join(working_dir, 'Estadisticas')
if not os.path.isdir(output_dir):
    os.mkdir(output_dir)
    
input_files = []

for r, d, f in os.walk(working_dir):
    for inFile in fnmatch.filter(f, '*.pix'):
        input_files.append(os.path.join(r, inFile))
# Iterate through list of files and run
for image in input_files:
    try:
        vimage(file    =    image)
        dbic    =    (image,[9])    # classification result
        dbib    =    []    # bitmap mask
        filv    =    filv_dir    # use FILE
        dbvs    =    [2]    # field boundaries
        ocolumn    =    ""
        samptyp    =    "MODE, MEAN"
        undefval    =    [-1]    # unclassified
        
        vimage(file    =    image)
        dbic    =    (image,[10])    # classification result
        dbib    =    []    # bitmap mask
        filv    =    filv_dir    # use FILE
        dbvs    =    [2]    # field boundaries
        ocolumn    =    ""
        samptyp    =    "MODE, MEAN"
        undefval    =    [-1]    # unclassified
      
    except PCIException, e:
        print e
    except Exception, e:
        print e

Jerson Andres Achicanoy 0 votes