PCI geomatics

PCI EASI Script [PIX_to_SHP_batch_export.eas]

This simple EASI script used with the MODEL command in PCI will batch convert vector files stored in PCIDSK (PIX) format into Shape File (SHP) format with the exact same file name as the input files. This was originally created for PCI Geomatica v9.1 but was last tested and working with no problems in PCI Geomatica v10.0


!—————————————————————————-
!—————————————————————————-
!
! Batch Export PIX Vector to SHP Script
! [PIX_to_SHP_batch_export.eas]
!
! This script will export vector segments from PIX files located in a
! given directory into Shape files and place the new files into the same
! directory. The script assumes that no SHP files with the same names
! already exist and all the input files are setup the same with the
! vector segments stored the same.
!
!—————————————————————————-
!—————————————————————————-
! Define variables
!—————————————————————————-

!to store location of input & output files

local string in_files

!for the file format and extension types

local string type, ext

!file names

local string bn, fn

!to store directory listing of input files

local mstring dirlist

!to store vector segment number

local integer vec

local integer i

local $Z

!—————————————————————————-
! Clear the EASI window and then show the header information
!—————————————————————————-

PRINT @(1 ,1,CLREOS)

print “———————————————————————–”
print @reverse,” ‘Batch export PIX vector to SHP’ EASI Script “,@alloff
print “”
print “”
print “”
print “———————————————————————–”
print “”
print ” This script will export vectors from PIX files in a given directory ”
print ” into SHP format using the same file names as the input files. ”
print “”
print ” All input vector files are expected to be setup the same with all ”
print ” vectors to be exported, stored using the same segment number.”
print “”
print “———————————————————————–”
print “”

!—————————————————————————-
! Collect input from user
!—————————————————————————-

print “Enter the directory that contains the PIX files to export to SHP:”

input “>” in_files

print “Enter the vector segment number that the vector is stored in:”

input “>” vec

!——————————————————————-
! Get the contents of the directory
!——————————————————————-

type =”pix

dirlist = getdirectory(in_files)

let $Z = “\

for i = 1 to f$len(dirlist)

!——————————————————————-
! Extract parts of the filenames
!——————————————————————-

fn = in_files + $Z + dirlist[i]

ext = getfileextension(fn)

bn = getfilebasename(fn)

if (ext ~= type) then

print “”
print “Exporting:”, bn, “from PIX to SHP”
print “”

!—————————————————————-
! Set up the parameters and execute the FEXPORT command
!—————————————————————-

fili = in_files + $Z + dirlist[i]
filo = in_files + $Z + bn
dbiw =
dbic =
dbib =
dbvs = vec
dblut =
dbpct =
ftype =”SHP
foptions =

R Fexport

PRINT @(1 ,1,CLREOS)

endif

endfor

PRINT @(1 ,1,CLREOS)

print “——————————————————————-”
print “”
print @reverse,” ‘Batch export PIX vector to SHP’ EASI Script Finished “,@alloff
print “”
print “——————————————————————-”

return

!—————————————————————————-
!—————————————————————————-