Take me to pcigeomatics.com

PCI Geomatics Help Center

How can we help you today?

PIX_to_SHP_batch_export

PCI Geomatics -

!----------------------------------------------------------------------------! 
!----------------------------------------------------------------------------!
!                                                                            !
!    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

!---------------------------------------------------------------------------- 
!---------------------------------------------------------------------------- 
Have more questions? Submit a request

Comments

Powered by Zendesk