tmackinnon.com - Canadian Geomatics Portfolio
  • Home
  • Dram Selection
  • Terms of Use
  • Cartography, GIS, and the Art of Map Making
  • GIS Mobile Mapping
  • GIS Web Mapping
  • Privacy Policy
  • Light Detection and Ranging (LiDAR)
  • tmackinnon Geospatial Resume
  • Search
  • Remote Sensing
  • Geographic Information Systems (GIS)
  • Geospatial Related Awards
  • Geospatial Publications
  • GIS and Geomatics
  • About Me
  • Contact Information
  • Click to open the search input field Click to open the search input field Search
  • Menu Menu

PCI EASI Script [PIX_to_SHP_batch_export.eas]

January 6, 2008/in EASI Scripts

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

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

https://tmackinnon.com/wp-content/uploads/PCI-geomatics.png 300 300 Ted MacKinnon https://tmackinnon.com/wp-content/uploads/tmackinnon_2022_4.png Ted MacKinnon2008-01-06 21:35:242014-05-22 07:01:45PCI EASI Script [PIX_to_SHP_batch_export.eas]

Multiple File Subset Script – PCI EASI Script

January 4, 2008/in EASI Scripts

This simple EASI script used with the MODEL command in PCI will batch subset a directory of input files based on a defined input window. It assumes that all the input files will all be located within the same specified directory, all the files will be of the same format with three channels and that the output directory does not already contain any files.

This was originally created for PCI Geomatica v9.1 but was last tested and working with no problems in PCI Geomatica v10.0 – Just copy the code below into a blank text file and edit as needed.

!—————————————————————————-
!—————————————————————————-
! Multiple File Subset Script [mul_subset.eas]
!
! This script was originally written for a user who wanted
! to have all of the fiducial marks and details removed from
! their air photos.
!
! This script assumes that all the input files will all be located
! within a given directory, all the files will be of the same format
! with three channels and that the output directory does not contain
! any files.
!
!—————————————————————————-

! Define variables
!—————————————————————————-

!for input and output directory local string in_files, out_files
!for directory listing of the input directories

local mstring dirlist

!for the file format and extension types

local string type, ext

!file names

local string bn, fn

!Parameters for the subset window

local integer x, y, width, height

local integer i

local $Z

local string confirm

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

PRINT @(1 ,1,CLREOS)

print “——————————————————————-“

print @reverse,” Multiple Subset “,@alloff

print “”
print “This script assumes that all the input files will all be located”
print “within a given directory, the files will be of the same format,”
print “have three image channels, will be clipped to the same extents and”
print “that the output directory will not contain any files.”

print “”

print “——————————————————————-“

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

print “”

print “Enter the directory that contains the input files:”

input “>” in_files

print “”

print “Enter the directory for the output files:”

input “>” out_files

print “”

print “Enter the file format of the files (3-letter file extension) : “

input “>” type

print “”
print “Enter the X coordinate for the dbiw parameter : “

input “>” x

print “”
print “Enter the Y coordinate for the dbiw parameter : “

input “>” y

print “”
print “Enter the width for the dbiw parameter : “

input “>” width

print “”
print “Enter the height for the dbiw parameter : “

input “>” height

print “”

PRINT @(1 ,1,CLREOS)

!—————————————————————————-
! Confirm with user to ensure that the parameters are correct
! If they are correct then continue with the script and if they are not
! then run the script over again.
!—————————————————————————-

print “—————————————————————————–“
print “”
print “The input directory you specified was:”

print ” “, in_files

print “”

print “The output directory you specified was:”

print ” “, out_files

print “”

print “The file format you specified was:”

print ” “, type

print “”

print “The initial coordinate of the clip you specified was:”

print ” “, x, ” “, y

print “”

print “Your image size you specified was:”
print ” “, width, ” “, height
print “”
print “—————————————————————————–“

print “Are these parameters correct? (Y/N)”

print “”

input “>” confirm

if (confirm ~= “y” or confirm ~= “Y” ) then

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

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 “Clipping:”, bn, “.”, ext

print “”

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

fili = in_files + $Z + dirlist[i]
filo = out_files + $Z + bn +”_clipped”
dbiw = x, y, width, height
dbic = 1,2,3
dbib =
dbvs =
dblut =
dbpct =
ftype = type
foptions =

R Fexport

PRINT @(1 ,1,CLREOS)

endif

endfor

else

run “mul_subset.eas

endif

PRINT @(1 ,1,CLREOS)

print “——————————————————————-“
print “”
print “The clipped files are stored in the following directory:”
print ” “, out_files
print “”
print “”

print @reverse,” Multiple Subset EASI Script Finished “,@alloff

print “”
print “——————————————————————-“

return

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

 

https://tmackinnon.com/wp-content/uploads/PCI-geomatics.png 300 300 Ted MacKinnon https://tmackinnon.com/wp-content/uploads/tmackinnon_2022_4.png Ted MacKinnon2008-01-04 20:55:242014-04-24 06:16:36Multiple File Subset Script – PCI EASI Script

Script to generate a PIX file large enough to contain all input DEM files

January 3, 2008/in EASI Scripts

Below is a simple EASI script used with the MODEL command in PCI will generate an output PIX file with extents large enough to contain all of the input files PIX files and then mosaic each of the input files into the output pix file. It was designed to mosaic several DEM files into one large DEM file.

This was originally created for PCI Geomatica v9.1 but was last tested and working with no problems in PCI Geomatica v10.0 – Just copy the code below into a blank text file and edit as needed.

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

! Multiple DEM Mosaic Script
! [mul_DEM_mosaic.eas]

! Ted MacKinnon – tmackinnon.com
!
! This script will generate an output PIX file with extents large enough
! to contain all of the input files and then mosaic each of the input
! files into the new output pix file.
!
! This script was designed to mosaic several DEM files into one large
! DEM file. Each input DEM file must have the same projection,
! resolution and at each DEM should have at least 150m overlap.
!
! The user is expected that the user will enter (or verify) the parameters
! of ‘CIMPRO’ at the bottom of this script prior to running the script.
! Parmaters such as BXPXSZ and DBIC have been hard coded.

!—————————————————————————-
!—————————
! Define variables
!—————————

!for input & output pix files and pixel size

local string inputFile, outputFile
local string pixel

!to obtain list of input files
local mstring inputList
local integer inputIndex

!for extracting georeferencing information

local GeoInfo geoInfo
local integer geoFile

!to contain bounding rectangle of all input files

local double boundULX, boundULY, boundLRX, boundLRY

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

PRINT @(1 ,1,CLREOS)

print “———————————————————————–
“
print @reverse,” ‘Mosaic multiple DEM files’ EASI Script “,@alloff
print “”
print “”
print “”
print “———————————————————————–“
print “”
print ” This script will generate an new output PIX file with extents large “
print ” enough to contain all of the PIX files in this directory and then “
print ” mosaic each of the PIX files into the new output file.”
print “”
print ” The output file will contain the following projection: “
print “”

! The projection will be printed to the screen as a general reminder

print ” UTM 11 S E000″

print “”
print “———————————————————————–“
print “”

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

print “”
print “Enter the Output file name:”
input “>” outputFile
print “”

print “Enter the pixel size for: “,outputfile

input “>” pixel

print “”
print “”

PRINT @(1 ,1,CLREOS)

!—————————————————————————-
! Create list of input files
!—————————————————————————-

sys “dir *.pix /b > pixlist.txt”

inputList = Text$Import(“pixlist.txt”)

!—————————————————————————
! Read georeferencing of each input file
!—————————————————————————-

for inputIndex = 1 to F$LEN(inputList)

print inputList(inputIndex)

geoFile = DBOpen(inputList(inputIndex), “r”)
call DBReadGeoInfo(geoFile, geoInfo)
call DBClose(geoFile)

print “Georeferencing: “, geoInfo.Units
print “Image extents: “,geoInfo.ULX, “, “, geoInfo.ULY, ” “, geoInfo.LRX, “, “, geoInfo.LRY

PRINT @(1 ,1,CLREOS)

!————————————————————————-
! initialize bounds using first file
!————————————————————————-

if inputIndex = 1 then

boundULX = geoInfo.ULX
boundULY = geoInfo.ULY
boundLRX = geoInfo.LRX
boundLRY = geoInfo.LRY

else

!———————————————————————–
! assumes UTM projection (ULY > LRY)
!———————————————————————–

if geoInfo.ULX < boundULX then
boundULX = geoInfo.ULX

endif

if geoInfo.ULY > boundULY then

boundULY = geoInfo.ULY

endif

if geoInfo.LRX > boundLRX then

boundLRX = geoInfo.LRX

endif

if geoInfo.LRY < boundLRY then
boundLRY = geoInfo.LRY

endif

endif

print “”

endfor

print outputFile, ” file extents: “, boundULX, ” “, boundULY, ” “, boundLRX, ” “, boundLRY

!—————————————————————————-
! create the output PIX file containing bounds
!—————————————————————————-

FILE = outputFile
TEX1 =

!Specify the # of channels here

DBNC = 1,0,0,0
DBLAYOUT = “PIXEL”

!Specify the projection info here

PROJECT = “UTM”
ZONE = 11
ROW = “S”
ELLIPS = “0”
LLBOUND = “N”

ULX = F$STRING(boundULX)
ULY = F$STRING(boundULY)
LRX = F$STRING(boundLRX)
LRY = F$STRING(boundLRY)
BXPXSZ = pixel
BYPXSZ = pixel
REPORT = “TERM”

run CIMPRO

!—————————————————————————-
! Mosaic each PIX file from the listing into the outputfile
!—————————————————————————-

inputList = Text$Import(“pixlist.txt”)

for inputIndex = 1 to F$LEN(inputList)

inputFile = inputList(inputIndex)

!————————————————————————–
! Clear the EASI window and show progress
!————————————————————————–

PRINT @(1 ,1,CLREOS)

print “”
print “Mosaicking “, inputFile, ” into “, outputFile
print “”

FILI = inputFile
DBIC = 1
DBVS =
DBLUT =
FILO = outputFile
DBOC = 1
BLEND =
BACKVAL = 0

run MOSAIC

endfor
!—————————————————————————-
!—————————————————————————-

https://tmackinnon.com/wp-content/uploads/S2_mosaic2.jpg 1028 1600 Ted MacKinnon https://tmackinnon.com/wp-content/uploads/tmackinnon_2022_4.png Ted MacKinnon2008-01-03 20:41:122012-01-17 15:29:59Script to generate a PIX file large enough to contain all input DEM files

Script to clip the unnecessary excess portions of an air photo mosaic

January 2, 2008/in EASI Scripts

Below is a simple EASI script that when used with the MODEL command in PCI will clip the unnecessary excess portions of an air photo mosaic created from Ortho Engine to an irregular buffered shape around a set study area. This was originally created for PCI Geomatica v9.1 but was last tested and working with no problems in PCI Geomatica v10.0 – Just copy the code below into a blank text file and edit as needed.

!——————————————————————————————–

! Irregular_Polygon_Clip [bitmap_clip.eas]

! Ted MacKinnon – tmackinnon.com

! This simple script used with the MODEL command in PCI EASI

! will clip the unnecessary excess portions of an airphoto mosaic

! to an irregular buffered shape around the study area.

!

! The working file ‘working-file.pix’ has the existing

! mosaic image located in the first three channels,

! an existing irregular shaped polygon bitmap and

! three empty 8 bit channels.

!

! %%2 is the bitmap mask of the irregular shape

! %1, %2, %3 are the RGB existing image channels

! %4, %5, %6 will be the new modeled RGB image channels

! the RGB value of 255, 255, 255 will set the background to white

!

! Simply change the file name to use this script with a different

! file and ensure that the channels and segments are setup the same

!——————————————————————————————–

!——————————–

! Set up and run the model

!——————————–

MODEL ON “working-file.pix” OVER dbiw

if %%2 = 1 then

%4 = %1;

%5 = %2;

%6 = %3;

else

%4 = 255;

%5 = 255;

%6 = 255;

endif;

ENDMODEL

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

! Export the resultant channels to a new file

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

FILI = “working-file.pix

FILO = “mosaic_clipped.tif

DBIW =

DBIC = 4,5,6

DBIB =

DBVS =

DBLUT =

DBPCT =

FTYPE = “TIF

FOPTIONS = “”

RUN FEXPORT

!——————————————————————————————–

 

https://tmackinnon.com/wp-content/uploads/berwick.jpg 669 805 Ted MacKinnon https://tmackinnon.com/wp-content/uploads/tmackinnon_2022_4.png Ted MacKinnon2008-01-02 20:31:562012-01-17 15:24:19Script to clip the unnecessary excess portions of an air photo mosaic

Color Shaded Relief Model – Gatineau, Quebec

September 24, 2007/in 3D Modeling, Digital Elevation Models, PCI Geomatica, Remote Sensing

This is one of several color shaded relief (CSR) models I created of Gatineau foot hills of Quebec. The city of Ottawa is featured in the national capital region near the bottom center of the image across the river just …

Read more
https://tmackinnon.com/wp-content/uploads/GAT-CSR1.jpg 343 476 Ted MacKinnon https://tmackinnon.com/wp-content/uploads/tmackinnon_2022_4.png Ted MacKinnon2007-09-24 11:06:242019-09-16 13:44:41Color Shaded Relief Model – Gatineau, Quebec

Color Shaded Relief Model of Vancouver Island

June 24, 2007/in 3D Modeling, PCI Geomatica, Remote Sensing

Color shaded relief (CSR) model created using a DEM of Vancouver Island, British Columbia using PCI Geomatica software. The …

Read more
https://tmackinnon.com/wp-content/uploads/Vancouver_Island_CSR.jpg 1325 1600 Ted MacKinnon https://tmackinnon.com/wp-content/uploads/tmackinnon_2022_4.png Ted MacKinnon2007-06-24 09:59:542019-01-02 13:23:08Color Shaded Relief Model of Vancouver Island

Color Shaded Relief Models – Pointe Du Chene, New Brunswick

June 24, 2006/in 3D Images, 3D Modeling, Digital Elevation Models, Flood Modeling, LIDAR, PCI Geomatica, Remote Sensing

Color Shaded Relief Models of Pointe Du Chene, New BrunswickColor Shaded Relief Models of Pointe Du Chene, New Brunswick with flood
The above two images were created for my LIDAR flood modeling graduate research project. The first image is before the flood scenario; featuring a color shaded relief perspective view pointing south east from the Northumberland Strait landwards across the Pointe Du Chene wharf. The second image is of the same color shaded relief perspective view but features a 2.55 m flood level super imposed on top of it.

The 2.55 m flood level was an actual recorded storm surge water level that effected this area during a winter storm on January 2001. The two images below show the same flood level and area but from an overhead aerial view. The first image is with an orthophoto and the second image is with the color shaded relief.

Pointe Du Chene, New Brunswick with floodPointe Du Chene, New Brunswick with flood

https://tmackinnon.com/wp-content/uploads/CapPele5.jpg 259 469 Ted MacKinnon https://tmackinnon.com/wp-content/uploads/tmackinnon_2022_4.png Ted MacKinnon2006-06-24 11:56:362014-06-24 12:04:57Color Shaded Relief Models – Pointe Du Chene, New Brunswick

Color Shaded Relief Model – Irvine, California

June 24, 2006/in 3D Modeling, Digital Elevation Models, PCI Geomatica, Remote Sensing

3D CSR Irvine California

The screen grab above was captured during the process of creating a color shaded relief model of Irvine, California. It was created in one of many demos I gave to clients while working for PCI Geomatics and was also used in the following tutorial that I created for the PCI geomatics website.

PCI Geomatics is a world leading developer of image centric geomatics software solutions. The PCI Geomatics flagship software, Geomatica, meets the growing demands of the remote sensing, GIS, cartography, and photogrammetry worlds. PCI Geomatics has long been recognized for offering high-value geomatics software solutions, advanced algorithms, excellent customer assistance, and product support for the widest range of spatial data formats in the industry.

https://tmackinnon.com/wp-content/uploads/3D-CSR-Irvine-California.jpg 296 358 Ted MacKinnon https://tmackinnon.com/wp-content/uploads/tmackinnon_2022_4.png Ted MacKinnon2006-06-24 11:18:122014-06-24 11:31:45Color Shaded Relief Model – Irvine, California
Page 1 of 212
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
2004 NB LIDAR project
3D Images
3D Modeling
AGRG
Arizona
Awards
Canada
Cartography
Central America
Data Integration
Digital Elevation Models
EASI Scripts
ERDAS
Flood Modeling
GIS
GPS
Granada
Image Gallery
International Travel
LIDAR
Managua
Masaya
Mobile Mapping
New Brunswick
Newfoundland
Nicaragua
North West Territories
Northern Ontario
Nunavut
Ontario
Other
Past Projects
PCI Geomatica
photogrammetry
Publications
RADARSAT
Remote Sensing
Resources
Rio Blanco
RS Software
Satellites
Spatial Modeling
Terrain Analysis
TITAN
Travel Blog
USA
Washington - DC
Web Sites Portfolio
Free Canadian Geospatial Resources
Download Canadian Open Data
Browse Canadian GIS Jobs
Canadian Geomatics News

Remote Sensing

  • Advocate Harbour Color Shaded Relief Map
    Advocate Harbour Color Shaded Relief MapJune 15, 2015 - 2:01 PM
  • Geomatics Acronyms and Abbreviations
    Geomatics Acronyms and AbbreviationsMay 30, 2014 - 6:44 AM
  • 3D Modeling with High Resolution LIDAR
    3D Modeling with High Resolution LiDARApril 24, 2014 - 1:42 PM
  • Color shaded reliefs utilize chromo stereoscopic techniques to help emphasize the depth of the Z dimension from traditional DEMs
    Color Shaded Relief ModelsJuly 3, 2012 - 9:31 AM

Cartography

  • Converting Decimal Degrees to Degrees Minutes Seconds
    Converting Decimal Degrees to Degrees Minutes SecondsDecember 29, 2017 - 8:36 AM
  • Advocate Harbour Color Shaded Relief Map
    Advocate Harbour Color Shaded Relief MapJune 15, 2015 - 2:01 PM
  • map showing UTM zones in Canada
    UTM Rows and ZonesFebruary 17, 2014 - 9:28 AM
  • Canadian using a UTM map
    Converting between UTM, MTM and LAT/LONGJuly 5, 2013 - 11:42 AM
Proud Supporter of the Royal Canadian Geographical Society
Proud to be a member of the Royal Canadian Geographical Society's College of Fellows

GIS

  • Time Zones in Google Earth
    Google Earth Time Zones ClockMarch 21, 2022 - 3:16 PM
  • Converting Decimal Degrees to Degrees Minutes Seconds
    Converting Decimal Degrees to Degrees Minutes SecondsDecember 29, 2017 - 8:36 AM
  • Geomatics Acronyms and Abbreviations
    Geomatics Acronyms and AbbreviationsMay 30, 2014 - 6:44 AM
  • Spatial Database Modeling of forest stands in Kejimkujik National Park
    Geomatics – GIS data base modelingMarch 5, 2014 - 11:30 AM
© Copyright tmackinnon.com
  • Link to X
  • Link to Instagram
  • Link to LinkedIn
  • Link to Facebook
  • Link to Pinterest
  • Link to Youtube
  • Link to Rss this site
  • Home
  • GIS and Geomatics
  • Contact
Scroll to top Scroll to top Scroll to top