Title: Automated Approach of Cataloguing TeraScan Images Utilizing Active Server Pages
1Automated Approach of Cataloguing TeraScan Images
Utilizing Active Server Pages
2Abstract
- The Center of Excellence in Remote Sensing
Education and Research (CERSER) on the campus of
Elizabeth City State University is currently
tasked with the responsibility of receiving
remotely sensed Advanced Very High Resolution
Radiometer (AVHRR) and Sea Wide Field-of-View
Sensor (SeaWiFS) data for research projects year
round. This data is collected, processed,
annotated, and transformed into images in the
Tagged Image File Format (tiff). These tiff
images are then uploaded to the CERSER archive
library server located at http//cerser.ecsu.edu.
Once uploaded, they are converted into various
resolutions and their information is added to a
tracking database maintained with Microsoft
Access software. This database provides a
searchable means for retrieving satellite image
data through various parameters.
3Abstract (cont)
- The automatic conversion of the original tiff
file to various Joint Photographic Experts Group
(jpeg) format sizes and the entry of information
into the tracking database were completed during
this project. Active Server Pages were developed
utilizing Visual Basic Scripting, Structured
Query Language, and Command Line instructions to
the software package ImageMagick to complete the
tasks. The final file developed was added as a
scheduled task to be implemented at a certain
time each day on the CERSER platform. This file
inventories the original folder located on the
CERSER server to determine if any files have been
uploaded and then processes those that have.
4Introduction - Overview
- Starting State of CERSER Image Process
- MMT Tasking
5Introduction - Process Goals
- Call the ASP page daily
- ASP Image Conversion Tasks
- Convert Date and Satellite information from the
file name - Open Terascan Database to obtain new file name
- Write new record to the database
- Open ImageMagick
- Convert/Resize/Rename original image to Actual,
Medium, Low, and thumbnail folders - Delete original image file
6Active Server Pages
- Defined
- Their Use
- Languages
- Microsoft Internet Information Services (IIS)
Server
7Database - Overview
- Project Use
- Defined
- Rolodex Card System
8Database - Fields
- Cells that contain actual data
- TeraScan DB field titles are ID, Date,
Satellite, Product, Description, and Event - Field Title gt Data Type Selected
- Examples Currency, Date Time, Number, text,
etc...
9Database - The Project
- Select information provided by the image file
name ID, Satellite, and Date - Convert this information to the correct format
(example 060330 to 03/30/2006) - Add a new record for each image
10ImageMagick - Overview
- Description
- Formats Supported
- Actions Available
- MMT Project Use
11ImageMagick - Command Line
- Description
- Input/Output, Text only
- Punchcards gt Command Line gt GUI
12Scheduled Tasks - Overview
- CERSER Operating System
- Scheduled Tasks
- Scheduling the ASP file
13Scheduled Tasks - Getting Started
14Scheduled Tasks Opening
- Selecting program to run.
15Scheduled Tasks - Naming
16Scheduled Tasks - Time Date
17Scheduled Tasks User Name Password
18Scheduled Tasks - Created
19Scheduled Tasks - Modifications
20Code -Pseudocode
- Defined
- Example
- Pseudocode - Display on the screen the variable
X - VBScript Coding- response.write(x)
21Code - Begin ASP Code
- lt!--BEGIN ASP CODE--gt
- lt
- lt!--
22Code - Declare Variables
- 'Declare Variables
- dim fs,fo,x, cnvrtDate, imgSat, dbPath, Con,
fdb, description, curevent, product, jsfExc -
- PUBLIC lastID
- Public utilized due to varible use in multiple
methods
23Code - Create File System Object
- 'Set File System Object
- set fsServer.CreateObject("Scripting.FileSystemO
bject") - 'Set path to uploaded images folder
- set fofs.GetFolder(server.mappath("\mmt\Pictures
\original\"))
fs Instance of FileSystemObject fo
c\\inetpub\wwwroot\mmt\Pictures\original\
24Code - Begin Image Processing Loop
- 'BEGIN Loop for files in Original Folder
- for each x in fo.files
fo.files All the files located in the folder
represented by fo fo c\\inetpub\wwwroot\mmt\Pic
tures\original\
25Code - Date Conversion
- 'START Date conversion
- cnvrtDateMid(x.name,3,2) "/" Mid(x.name,5,2)
"/20" Mid(x.name,1,2)
cnvrtDate reformatted date (YYMMDD to
MM/DD/YYYY) Mid(string, start, length) example
Mid(CERSER, 3, 2) RS
26Code - Satellite Name Conversion
- 'START Satellite Conversion
- if Mid(x.name,13,1)"n" then
- imgSat "NOAA-" Mid(x.name,14,2)
- End if
- if Mid(x.name,13,1)"s" then
- imgSat "Seawifs-" Mid(x.name,14,2)
- End if
imgSat reformatted satellite name (n17 to
NOAA-17)
27Code - Set Path to Database
- 'Set path to Database
- Set fdb(fs.GetFolder(server.mappath("/mmt/")))
- dbPath fdb "\terascan_trial.mdb"
server.mappath c\\inetpub\wwwroot\ fdb Path
to folder containing the database -
c\\inetpub\wwwroot\mmt\ dbpath Path to
Database - c\\inetpub\wwwroot\mmt\terascan_trial.
mdb
28Code - Open Database
- 'create connection object, Con is now an instance
of ADODB.Connection - SET Con Server.CreateObject(
"ADODB.Connection") - 'open the database
- Con.Open "ProviderMicrosoft.Jet.OLEDB.4.0Dat
a Source" dbPath
dbpath Path to Database - c\\inetpub\wwwroot\mm
t\terascan_trial.mdb
29Code - Open Records
- 'create recordset (rs) object, rs is now an
instance of ADODB.recordset -
- set rsServer.CreateObject("ADODB.recordset")
- 'Select ONLY the ID column, order it descending
using the Con connection - rs.Open "SELECT ID FROM Images ORDER BY ID
DESC", Con
30Code - Create New ID
- 'Add one to the ID highest number retrieved and
place it in lastID, close connection -
- for each y in rs.fields
- lastIDy.value 1
- next
-
- rs.close
31Code - Assign Values
- 'Assign null or zero values to empty fields
- description""
- curevent"0"
- product"0"
32Code - Open the Image Table
- 'open the "Images" table in the
terascan_trial.mdb -
- rs.Open "Images", Con , 1, 3, 2
rs.open source, connection, CursorTypeEnum,
LockTypeEnum, CommandTypeEnum
33Code - Add Values
- 'Use AddNew method to create the new record
- rs.AddNew
- rs("date") cnvrtdate
- rs("id") lastID
- rs("description") description
- rs("event") curevent
- rs("product") product
- rs("satellite") imgSat
34Code - Update DB
- 'Set update to true and confirm update, Update
method confirms the update -
- rs.Update
-
- 'close the recordset and database connection
-
- rs.close
- Con.close
35Code - Copy/Rename Original
- 'Copy Original file to Actual Folder and rename
using the Copyfile method -
- fs.CopyFile fo "\" x.name, fdb
"\Pictures\Actual\" lastID ".tiff"
fo c\\inetpub\wwwroot\mmt\Pictures\original\ fd
b c\\inetpub\wwwroot\mmt\
36Code - Define New Variables
- ' Define variables for Image Conversion with
ImageMagick - Dim WshShell, oExec, CommandLine, imageMagick,
orgTiff, desJpg
37Code - Initialize Variables
- 'Set current position of executable convert.exe
- imageMagick "C\Program Files\ImageMagick-6.2.6
-Q8\convert.exe" - 'Set position of orginal file to be converted
- orgTiff fdb "\Pictures\Actual\" lastID
".tiff"
fdb c\\inetpub\wwwroot\mmt\
38Code - Create Windows Object
- ' Creating a Windows Shell object in order to
access the command line prompt -
- Set WshShell Server.CreateObject("WScript.Shell
")
39Code - Medium Conversion
- 'Set Destination of Medium Copy, no size change,
just type tiff to jpg - desJpg fdb "\Pictures\Medium\" lastID
".jpg" - 'Compile arguments into one variable
- CommandLine imageMagick " " orgTiff " "
desJpg - ' Launching imgmagick
- Set oExec WshShell.Exec(CommandLine)
fdb c\\inetpub\wwwroot\mmt\ imageMagick
c\Program Files\ImageMagick-6.2.6-Q8\convert.exe
orgTiff c\\inetpub\wwwroot\mmt\Pictures\Actual\
lastID.tiff
40Code - Low Conversion
- 'Set Destination of Low Copy, resize 50, type
tiff to jpg - desJpg fdb "\Pictures\Low\" lastID
".jpg" - 'Compile arguments into one variable
- CommandLine imageMagick " " orgTiff "
-resize 50" " " desJpg - ' Launching imgmajic
- Set oExec WshShell.Exec(CommandLine)
fdb c\\inetpub\wwwroot\mmt\ imageMagick
c\Program Files\ImageMagick-6.2.6-Q8\convert.exe
orgTiff c\\inetpub\wwwroot\mmt\Pictures\Actual\
lastID.tiff
41Code - Thumbnail Conversion
- 'Set Destination of Thumbnail Copy, resize 15,
type tiff to jpg - desJpg fdb "\Pictures\Thumbs\" lastID
".jpg" - 'Compile arguments into one variable
- CommandLine imageMagick " " orgTiff "
-resize 15" " " desJpg -
- ' Launching imgmajic
- Set oExec WshShell.Exec(CommandLine)
fdb c\\inetpub\wwwroot\mmt\ imageMagick
c\Program Files\ImageMagick-6.2.6-Q8\convert.exe
orgTiff c\\inetpub\wwwroot\mmt\Pictures\Actual\
lastID.tiff
42Code - Free Up Memory
- 'Free WshShell memory
- Set WshShell Nothing
- Set oExec Nothing
43Code - Delete Original/End loop
- 'Delete Original Image
- fs.DeleteFile(fo "\" x.name)
- next
fo c\\inetpub\wwwroot\mmt\Pictures\original\
44Code - Memory/Update Time
- 'Free fo, fs, and fdb memory
- set fonothing
- set fsnothing
- set fdbnothing
- 'Write out the time that the Database was updated
- response.write("Terascan Database Updated "
now() " (Eastern Time)")
45Code - End Comment/ASP
46Results
- Trial Code
- reponse.write()
- Final Version
- Folder Permissions
47Results Update Notification
- TeraScan Database - New Table
- ASP Modification
48Future Work
- Modify Records
- Email Notification
49Questions