Download Using SAS® Software to Develop a Geographical Database for Aerial Photography

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Concurrency control wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Database wikipedia , lookup

Functional Database Model wikipedia , lookup

Relational model wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
USING SAS® SOFTWARE TO DEVELOP A GEOGRAPHICAL
DATABASE FOR AERIAL PHOTOGRAPHY
Shlomit Yaari, Computer Center, Bar-Han University, Ramat Gan, Israel
ABSTRACT
number of different research projects
conducted in the department over the last
twenty years.
Unfortunately, no written
records were left with the photographs, so
that it was not possible to identify the
photographs, when they were taken, nor
to what geographical area cover they
belong.
A database containing information on
more than 20,000 aerial photographs was
established
at
the
Department
of
Geography and the Computer Center of
Bar-Han University.
Aerial photography
provides a unique source of information
for mapping and landscape changes.
The past few years have witnessed an
increasing
interest in
mapping
and
determining the landscape changes which
have occurred in Israel and the region.
Aerial photography provides a unique
source of information for this purpose.
It
was therefore necessary to establish a
suitable database management, retrieval
and reporting system,
which would
provide
information
regarding
the
availability
of
photographs
in
the
department and their area coverage. So as
to minimize the number of records, the
database contains information about a
sequence of photographs rather than
individual ones.
The database was constructed using SAS as
database
management
system,
a
integrating the following products:
SAS/BASE®, SAS/AF®, SAS/FSp®, SASSQL/DS® and SAS/GRAPH®.
A full-screen application was developed
using the menu structure of SAS/AF
software which enables the researcher to
update, retrieve, summarize and display
data.
The data collected is maintained by IBM®' s
VM relational database SQL/DS® and can be
extracted to create a SAS data set, using the
SAS-SQL/DS interface. The data set created,
containing
records
meeting
certain
criteria defined by the user, can be
further utilized for a variety of statistical
analyses.
INTRODUCTION
The following information is included in
the database:
Time
photography was taken
(year, month, day, hour,
minute)
Height
of flight (in meters)
of photography (in km.)
~
Coordinates of the rectangle describing
the region photographed
(with accuracy to tens of
meters)
Fli ght details
number and code for the
company which provided the
photographs
Sequential no.
of photographs included in
the record.
The Department of Geography of Bar-Han
University maintains a collection of over
20,000 aerial photographs of the State of
Israel which were purchased for a large
The goal of developing this system was to
help the researcher update the database
and produce reports and graphs of the
data.
SAS/FSP is used to add to and update the
data, which is automatically checked for
inconsistencies and accuracy.
Reporting
and
graphical
display
capabilities were furnished by SAS/BASE
and SAS/GRAPH.
This
application
combines
database
management, data entry, reporting tools
and graphics display into one integrated
system.
7
This
paper
illustrates
the database
management capability of SAS as well as
its power to integrate several features,
which provide the ability to retrieve,
update, subset, produce reports, and
display graphical output.
2. retrieve information from the database
according to specific criteria.
Choosing option 1 results in a Data Entry
Screen (Figure 3) created using SAS/FSP
software.
SYSTEM OVERVIEW
Figure 3.
Data EntfY Screen
The following flowchart demonstrates the
design of the application (Figure I):
Figure 1.
Application
/
Command ==>
Flowchart
Year: .... Month:.. Day:.. Hour:.. Minute:.
Height: .... Scale: .....
MAIN MENU
Central Focal Point: XO:
YO:
Coordinates: Xl..... Y 1 •••••
X 2 .....
CONSTRUCT
UPDATE
DATABASE
Y2 .....
Locality:
END
QUERIES
Photo sequential no ...
DISPLAY
GRAPH
ON
GRAPHIC
TERMINAL
PRINT
REPOItT
PRINT
The main menu of the
presented in Figure 2.
The various entry fields appearing on the
screen contain information about the time
the photography was taken, height of
flight, scale of photography, coordinates
of the rectangle covering the area
photographed and flight details.
BACK TO
GRAPH
ON LASER
PRINTER.
MAIN
MENU
application
is
Option 2 of the Main Menu (Figure 4)
enables the user to extract a SAS data set
containing observations meeting userdefined criteria.
Figure 2. Main Menu
for Geographical Database
MAIN
Select Option ===>
MENU
Press End to Return
Geographical Database
for Aerial Photography
Select an option and press ENTER
1. Update file
2. Construct queries
3. End
Two main tasks are available:
1. add or
database;
update
observations
to
the
8
Figure 4. A Program Screen
for Constructing Oueries
Figure 5. A Sub-Meuu Screen for
S electing Print Options
PRINT SCREEN
!.iL.
Select Option ===>
Select an option and press ENTER.
Command ===>
Fill in the query parameters:
year
month
day
hour
2.
Display graph on a graphic terminal
.... .... ....
.. .. ..
.. .. ..
.. .. ..
. ... -....
· . -· .
· . -· .
· . -· .
3.
Print graph on a laser printer
4.
Back to main menu
APPLICATION DEVELOPMENT
The application executes in Version 5.18 of
SAS under VM/CMS_ operating system.
....
The major areas of activity involved in our
database maintenance are:
1. data entry and validation;
2. extracting a SAS data set containing
records meeting criteria defined by the
researcher;
3. generating output of reports and
graphs.
<lb.
Command ===>
FLIGHT DETAILS
COMPANY:
photo
photo
sequence no.
sequence no.
fi rs t
·.
Print report
Contiguous
Numbers
Press PfB to continue.
·.
·.
1.
Ordinal
Numbers
Coordinates: Xl ..... yl .....
X2 ..... Y2 .....
Locality:
.... .... .... ....
flight no.
Press End to Return
....
....
....
The above
goals were accomplished using
the following modules:
SAS/SQL-DS, SAS/BASE, SAS/AF, SAS/FSP
and SAS/GRAPH.
last
. ...
. ...
....
The full screen application was developed
using the menu structure of SAS/AF
software.
The data collected is maintained
by IBM's VM relational database SQL/DS.
An SQL/DS table was created using SQL
commands
for
defining
columns
(variables) aud their attributes.
Press Pf3.
Filling
in
the
above
entries
and
submitting the screen for processing, will
display
the report on the terminal
(Appendix A).
The data entry screen was built using the
FSEDIT procedure of SAS/FSP.
The
interface
between
SAS/SQL-DS
software and PROC FSEDIT is invoked by
specifying the T ABLE=
option of the
FSEDIT statement, and enables access to the
SQL/DS table.
The user is then requested to select one of
the following options (Figure 5):
1. produce an hardcopy version of the
repo rt
2. display a graphic output on terminal
3. produce a graphic output to a laser
printer.
On-line
checks
are
available
using
SAS/FSP FSEDIT screens with the attribute
screens feature. Required fields must be
filled in before leaving the screen.
9
Minimums, maximums, initial values and
valid values were defined for every field
to reduce errors during editing.
Extracting a SAS data set is accomplished
by entering parameters through a "fill in
the
blank"
full-screen.
The
screen
program used to read the parameters and
create a subset file combines the following
tools:
SAS/AF, SQLEXT procedure of SAS/SQL-DS
interface and the MACRO facility.
In addition,
accessibility of information.
the application demonstrated the power of
the SAS System in integrating several
products and interfaces into a userfriendly
system,
which
enables
the
researcher to update, retrieve, construct
queries, generate
reports and create
datasets for further analyses, without
having to write a SAS code.
Future enhancements are planned which
will utilize the SCL (Screen Control
Language) feature of SAS/ AF, for crossfield validation.
In addition, a new screen
will be implemented to enable selection of
parameters according to which the report
will be sorted.
The retrieval can be carried out on the
basis of date,
coordinates of area
photographed,
sequential
number
of
photographs and flight details, or any
combination of the above.
The report is created by a FILE PRINT
option and a PUT command.
Duplicate records will be deleted from the
database and a report of the deletions will
be issued periodically.
SAS/GRAPH was used to display a graph of
the region photographed, defined by
coordinates of rectangles covering the
area.
Lastly, the regions photographed will be
displayed in their correct geographical
posItIOn on the map of Israel, in keeping
with their coordinates.
Annotate data sets were used to position
text labels on graph and draw rectangles
according to specified coordinates.
To that
purpose, GSLIDE procedure accompanied
by the ANNOTATE= option and the %LABEL
and %RECT annotate macros, were utilized.
ACKNOWLEDGMENTS
The author is indebted to Dr. Maksim
Shoshani of the Department of Geography
at Bar-Ilan University for providing her
with the data used in the system and for
his helpful contributions towards the
design of the system and to Mrs. Helen
Lissar for assistance in the preparation of
the manuscript and illustrations.
The main program of the application
(APPENDIX B) is included in a program
type screen of SAS/AF.
The program is
comprised of several macros.
References:
A macro for selecting records from the
database according to coordinates of a
rectangle is based on the SELECT command
of the SQLEXT procedure.
SAS User's Guide:Basics, Version 5 Edition,
Cary, N.C.: SAS Institute Inc., 1985.
SASIAF User's Guide
Version 5 Edition,
Cary, N.C.: SAS Institute Inc., 1985.
SASIFSP User's Guide Version 5 Edition,
Cary, N.C.: SAS Institute Inc., 1985.
SASISQL-DS User's Guide Version 5 Edition,
Cary, N.C.: SAS Institute Inc., 1985.
SASIGRAPH
User's
Guide
Version 5
Edition, Cary, N.C.: SAS Institute Inc., 1985.
Another macro is used to select records
according to date, locality and flight
details and is based on conditional
execution indicators of SAS/AF allowing
for 'if statements
to
be
executed
conditionally whether or not user values
are entered.
SAS, SAS/AF,
SAS/BASE, SAS/FSP,
SAS/GRAPH,
and
SAS-SQL/DS
are
registered trademarks of SAS Institute Inc.
of Cary, N.C., U.S.A.
SUMMARY
This paper has presented a software
system developed to maintain information
on aerial photography.
The use of SAS System has proved to be an
effective tool for managing large scale
databases and improving the quality and
IBM and SQL are registered trademarks of
International
Business
Machines
Corporation.
10
APPENDIX A
AERIAL PHOTOGRAPHY DATABASE REPORT
Query Date - 01/01/92
Query Details
Year: 1960-1961
Yr Mo Day Hr Min Scale
Central
Height Coordinates
XO
YO
Sequent. No.
Coordinates
Yl
X2
Y2
Locality
Area
Xl
Comp Flgt
60
6
17
14
2
15555 2000
1631
137
165
139
161
137
229
60
6
17
11 42
166666 2880
167
136
168
138
165
134
7900
11
14 37
625000 8521
186
136
185
136
184
136
60
125 587
417 446
First
Last
MM
46
7714
7716
MM
46
7291
7293
MM
35
3712
3713
61
8
26
11
16
19672 1920
2039 2568
2010 2500 2070
2970
MM
60
4667
4672
61
8
26
11
19
20454 1880
20570 2552
2070 2578 2034
2535
MM
60
4673
4674
61
8
26
11
17073 1830
2068 2645
2091 2657 2063
2588
443
MM
60
4600
4604
61
8
26
10 16
36956 3690
2071 2557
2098 2578 2034
2535 1125
MM
60
4516
4519
if year=&yyl ## ##yy2 or year=&yy2 -#it ##yy3 or year=&yy3 ## ##yyl ; ##
#tiyzl
if
&yzl < = year < = &yz2;
APPENDIX B
##
/********************************************
* PROGRAM TO CONSTRUCT QUERIES ACCORDING *
*
* TO PARAMETERS ENTERED BY THE USER
*
* IN A FILL-IN-THE-BLANK SCREEN
#::ml
if month=&ml ## ##m2 or month~&m2 ## ##m3 or month=&m3 ## ##ml ; ##
##nl
if
&nl < ~ month < = &n2 ;
********1:***********************************/
%cms filedef prin disk grf doch a (redm vba ireel 137 blksize 141.
goptions device = ibm3119 nodispiay notext82;
options dquote mprint macrogen mautosoufce;
proc sqleu out = aa ;table = shlomiuazastd ;
:;d'l
if day=&dl ## ##d2 or day~&d2 ## ##d3 or day=&d3 ## ##<11; ##
##el
if
&el <= day <= &el;
## ;
##hl
if hour- &hI ## ##h2 or hour= &h2 ## ##h3 or hour= &h3 ## ##hl ; ##
##il
if
&il <= hour <= &fl;
## ;
H#isl
/********************************************
* MACRO TO SELECT RECORDS ACCORDING TO
*
* COORDINATES OF RECTANGLE
*
if
yisuvl=&isl or yi1UVl=&id or yisuv3=&isl or yisuv4=&isl
or yisuvS=&isl;
##
********************************************/
%macro ticumm;
%Iet xxxi"" &xl;
##i$1.
if
yisuvl = &ls2 or yisuVl= &is2 or yisuvl = &is2 or yisuv4= &is2
or yisuv5 = &is2;
##
##is3
if
yisuvl = &is3 or yisuv2 = &is3 or yisuv3= &is3 or yisuv4= &is3
or yisuvS ~ &is3;
#.
%rif'/~l%th<::n "/odo;
%let textic= %str««&xl < = tkumxl and ticumd < = &xl) and
(&yl< =ticumyl and ticumyl< ~&y2)1
or «&xl < = ticumx2 and tkumx2 < = &x2) and
(&yl < =ticumy2 and ticumy2< =&y2))),);
%str(select • from shlomit.tazastd where &textic;};
%end;
%if &xxxI ~ %str() %then %do;
%str(select • from shlomit.ta~astd ;1;
%end;
%mend ticumm;
%ticumm
##is4
if
yisuvJ '" &i$4 or yisuv2 = &is4 or yisuv3 '" &1$4 or yisuY4 = &is4
or yisuvS = &is4;
##
##isS
if
yisuvl = &isS or yisuVl = &isS or yisuv3 = &isS or yisuv4 = &isS
or yisuvS = &is5;
##
##r::v
if kitlugl= '&r;v'; ##
##gc:l if (kitlug2 = &gc:l ##
##strl and kitlugl = > &strl ## ##endJ and kitlug4 < = &endl ##
##gel 1 ##
/********************************************
CONSTRUCTING QUERIES ACCORDING TO YEAR, *
MONTH,DAY,HOUR,LOCALITY,COHPANY
AND
*
*
FLIGHT
DErAILS
*
*
*
********************************************/
data aa'set aa'
##yyl'
,
11
##gc2 or (kiUug2 = &gc2 ##
##Str2 and kitlug3 = > &str2 ## ##end2 and kitlug4
&end2 ## ##gc2 ) ##
##gc3 or {kitlug2 .. &gc3 ##
##str3 and kitlugl = > &rtr3 ## ##end3 and kitlug4
&end3 ## ##gc3 1 ##
#i:gc4 or (kitlug2 = &gc4 ##
##str4 and kitlug3 = > &str4 ## ##end4 and killug4 < '" &end4 ## ##Gc4 ) ##
##gcl ; ##
@103 "Sequential number"
@40 'Central' /
@2 'Year' @7 'Month' @12 "Day' @IS 'Hour' @I9 'Minute" @25 'Scale"
@31 "Height" @38 "Coordinates' @53 "Area Coordinates'
@80 'Locality
,
@101 "CompO I
@39 'XO' @45 "YO' @SI 'Xl' @S1 "Yf @63 'Xl' @69 "Y2'
@101 '·any' @I06 'Flight" @1l6 "Sequent No" J
@2"===="@7"==0;=""@12'==='
@IS'= ~~' @19 '= = = = = =' @25"====='
@31'======"@3S'=========='
@51"-=-==============----"
@n'============-----------='
@IOI'==============-==--==-'
return;
end;
/********************************************
* PRINTING A MESSAGE IF NO RECORDS MET
*
THE SELECTION CRITERIA
*
*
********************************************/
ll .. t .. lJ;
file prin linesize=132 header=h;
set aa
point= _0_ nobs= nobsn;
if nobm = 0 then do;
file print;
PUT ///l/ @IS ' ........................................ '.
! @IS '. NO OBSERVATIONS SELECTED •
! @15 ' ........................................ '
Jl @IS 'Press PF3';
if error = 1 then stop;
end;
-
/********************************************
•
/**********":*********************************
* PRINTING A REPORT OF RECORDS MEETING
•
THE SELECTION CRITERIA
•
data a-set aa'line= l-kl!:= I'
text. = tnm( kitlugl )11 t~im{kitlug2)11 trim{killug3)1 itrim(Kitlug4);
##xl
data entry;
ticumxl = &xl;
ticumx2 = &xl;
ticumyl-&yl;
if nobm gt 0 then do;
if error = I then stop;
date = daleO;
put @2 year 4. @8 month 2. @12 day 2. @16 hour 2. @20 minute 2@23 Imem 7. @31 height 4. @36 nzmxO 5. @42 nzmyO 5.
@48 ticumxl 5_ @S4 ticumyl 5.
@60 ticumx2 S. @66 ticumy2 5.
@72 (yisuvl-yisuvS) (4. +1) @lOl kitlugl $char3.
@lOS kitlugl 4. @IIO kitlugJ 5. + 2 '.' kitlug4 5.
ticumy2= &y2;
#i;
data minmax;set a
##xl
entry
i::;
return;
H: PUT @47 "AERIAL PHOTOGRAPHY DATABASE REPORT)
@~'=========~~-~~================~~-'
1/
/*****'/:**************************************
* PRINTING THE SELECTION CRITERIA DETAILS •
*
******1<**1:*1:*:':*************************,':****/
##yyl
@2 'Year."
##
'&yyl
"&yy2'
"&yzi'
"&yz2'
ticumx2 = &xl;
ticumyl ~ &yl;
ticumy2 - &y2;
proc sort;by kk;
annoll;by I!:k:
data allent;merge mm
ntieumxl ~ IOO'(ticumxl-minxlf(maxx-minx);
nticumxl= lOO"(ticumx2-minx}/(maxx-minx);
nticumyl = 100*(ticumyl-minY)i(maxy-miny);
ntieumy2= lOO'(ticumy2-minY)i(maxy-miny);
data annol;set allent;
%system(3,3,3};
line=2;
%rect(nticumxl,nticumyl,nticurnx2,nticumy2,cyan,tine,O.I);
##
##ml
@2 "Month:' '&ml' '&m2 " "&m3 "
##
##nl
@2 "Month:" '&nl' '-" '&02"
##
##dl
@2 "Day:' '&dl '..,2 '&dl I
I
##
##
##el
@2 'Day:' '&el
"&e2
I
##
##hl
@2 "Hour:' '&hl
'&h2
<&h3
I
##
##il
'&i2"
@2 'Hour:' '&iJ'
##
##xl
@2 "Coordinates:" 'XI=" '&xl' 'YI=' "&yl ' '10-=' '&xl" 'Y2=' '&y2' I
..
##
#;iisl
@2 'Locality:"
"&isl
'&is2' "&is3 ' '&is4'
@2
'Squentail no,:
"&isS' /
'Company:
'&~
:i#gc2 '
;;;#gcl '
##gc4 '
!
"&gcl
"&gc2
'&gc3
....'"
##nrl
1i;;strZ
::;istr3
##str4
·&strJ'
'&ltrZ'
·&str3'
'&str4'
ii#xi
annol
##
I
proc gslide anno = anno ;
;:;;:;
Flight:
Flight:
Flight:
Flight:
data ann02;mergoe a mm;by lek;
nticumxl = IOO"(ticumxl-minxl/(maxx-minx);
nticumx2= IOO·(ticumxl·minxJ.i(maxx·minx);
ntieumyl = IOO"{ticumYl-minYHmaxy.miny);
nticumy2= IOO-(ticumyZ-minYl/(maxy·mioy);
data anno2;set anno2;
%system{3,3,3);
%rea{nticumxl,nticumyl.nticumx2.nticumyZ,red.line.O.l);
%label{nticumxl,nticumyl,text.yellow,O.0,2,simplex,3);
data anno;set ann02
it#
##
#i:iC\l
#itgd
proc means data=minmax min max noprint;
var ticurnxl ticumx2 ticumyl ticumy2;
output out = mm min = minxl minxl minyl miny2
max= maxxl ma.xx2 maxyl maxy2 ;
data mm;set mm;minx= min{minxI,minx2);
miny= min(minyl.minyZ);
maxx = max(maxxl,maxx.2);
maxy= max(maxyi,maxy2);
~i~=~~I-&XI;
'&yy3"
##yzl
@2 'Year:'
##
~~: l;ort;bY lek;
ji#xl
data annolI;
•
IN TOP OF THE REPORT
'&endl'
'&end2"
'&end3'
'&end4'
•
•
***************~':***1:*************1:**********/
*
********,,:***********************************/
@60 "QUERY DATE-' @72 DATE DDMM¥YS_
@4 ' Query Details','
@3 '= = = = = = = = = = = = = = = =' !
CREATING AN ANNOTATE DATA SET TO DRAW
* RECTANGLES AND LABELS
##
##
run;
%cms browse grf doch a;
proc display c= geograLtaza"graph.menu;
run;
##
##
••
12