Work with GIS ARCVIEW leads to large directories with numerous files consisting of many projects and tables and views, etc. Due to the complexity of the directories, it is impossible to see all the links between these tables, themes,... A database containing all of the relevant information would help in locating data and reduce the searching time.
The project description is in a file with the suffix .apr. The file format is ASCII, but the structure is not documented by ESRI. So we modified the structure and put this information with a perl-script in an appropriate database form.
A GIS consists of
geometry descriptions and attributes. The attributes describe the objects like
roads, areas, etc. All attributes are stored in table form. One ARCVIEW-project
contains many tables with specific information. For example, there are tables
for the views, layouts, ... Each table contains common parameters like name,
type, comments... and specific parameters like map_units, distance, scale... In
addition, each table contains link-parameters like vtab_id, ftab_id,
view_id, ... This kind of parameter connects the tables. So each table contains
at least the proj_id that guarantees the association to the project.
One table can link many projects together. It is common practice to use one
theme in different projects. That means that the geometry is unique, but the
description of the theme is stored in the project and has its own proj_id.
The other link parameters are also important. For example, the
gis_tables is described by gis_tabs by the link
tabs_id.
Every trained user of GIS recognises this kind of structure
in ARCVIEW. But the structure is only readable with ARCVIEW for one open
project. If you want to import another theme, you have to know the name and the
path to the theme. Additionally, you should know the contents of the theme. If
you are not sure, you have to check it by opening the theme.
Another
question is: Is there a layout for my problem? or Who has created a
particular table? and so on. There are a variety of questions which may be
posed. With use of our database, the projects can be previewed without opening
the GIS and thereby save time. .
The perl-script "parser.pl" reads all apr-files in the start directory
and in all subdirectories. The output of the parser.pl is a set of
sql-statements in the stdout. You can use that with parser.pl > data.sql
. The output of parser.pl will be in the data.sql. The table definition is
in the file table.sql , We use for our task
mysql as database-server
and/or access a
web-interface written in php
as front end. The structure of tables is easy to understand and can be
used to create a powerful view of the GIS-basis. But this part depends on the
task. We use it as a meta-information system via the www for our partners
outside the institute. Within the institute, the database is helpful for the
researchers who work with the GIS. In that case, we will develop a access-front
end.
The table definition looks like:
use db_gis;
drop TABLE gis_projects;
create TABLE gis_projects
( proj_id INT PRIMARY KEY,
proj_name VARCHAR(132) NOT NULL,
proj_creator VARCHAR(64),
proj_creation_date VARCHAR(64),
proj_dependency VARCHAR(64),
proj_path VARCHAR(132),
proj_workdir VARCHAR(132),
proj_comments TEXT,
proj_version VARCHAR(5),
proj_serialno VARCHAR(15),
proj_line_count INT
);
drop TABLE gis_themes;
create TABLE gis_themes
( theme_id INT PRIMARY KEY,
theme_name VARCHAR(254),
theme_creator VARCHAR(64),
theme_path VARCHAR(128)NOT NULL,
theme_comments TEXT,
theme_featuretype VARCHAR(10),
theme_subfeaturetype VARCHAR(32),
theme_join VARCHAR(24),
theme_link VARCHAR(24),
vtab_id INT,
ftab_id INT,
view_id INT,
sc3c_id INT,
proj_id INT
);
drop TABLE gis_views;
create TABLE gis_views
(view_id INT PRIMARY KEY ,
view_name VARCHAR(132) NOT NULL,
view_creator VARCHAR(64),
view_creation_date VARCHAR(64),
view_comments TEXT,
view_map_units VARCHAR(5),
view_distance_units VARCHAR(5),
view_left VARCHAR(10),
view_right VARCHAR(10),
view_top VARCHAR(10),
view_bottom VARCHAR(10),
view_scale VARCHAR(20),
view_grafic_count INT,
proj_id INT
);
drop TABLE gis_sc3d;
create TABLE gis_sc3d
(sc3d_id INT PRIMARY KEY ,
sc3d_name VARCHAR(132) NOT NULL,
sc3d_creator VARCHAR(64),
sc3d_creation_date VARCHAR(64),
sc3d_comments TEXT,
sc3d_themes VARCHAR(128),
sc3d_left VARCHAR(50),
sc3d_right VARCHAR(50),
sc3d_top VARCHAR(50),
sc3d_bottom VARCHAR(50),
sc3d_zfaktor VARCHAR(20),
sc3d_zscale VARCHAR(20),
sc3d_texture_size VARCHAR(5),
sc3d_grid_size VARCHAR(5),
sc3d_scale VARCHAR(20),
sc3d_grafic_count INT,
proj_id INT
);
drop TABLE gis_layouts;
create TABLE gis_layouts
(layout_id INT PRIMARY KEY ,
layout_name VARCHAR(132) NOT NULL,
layout_creator VARCHAR(64),
layout_creation_date VARCHAR(64),
layout_comments TEXT,
layout_reportunits VARCHAR(5),
layout_units VARCHAR(5),
layout_type VARCHAR(5),
layout_grafic_count INT,
view_id INT,
proj_id INT
);
drop TABLE gis_tables;
create TABLE gis_tables
(tables_id INT PRIMARY KEY,
tables_name VARCHAR(20),
tables_creator VARCHAR(64),
tables_creation_date VARCHAR(64),
tables_path VARCHAR(128),
tables_comments TEXT,
tables_connect VARCHAR(128),
tabs_id INT,
proj_id INT
);
drop TABLE gis_tabs;
create TABLE gis_tabs
(tabs_id INT PRIMARY KEY,
tabs_name VARCHAR(20),
tabs_type VARCHAR(10),
tabs_btab INT,
tabs_join VARCHAR(128),
tabs_link VARCHAR(128),
tabs_connect VARCHAR(128),
tabs_query VARCHAR(128),
tabs_path VARCHAR(128),
proj_id INT
);
drop TABLE gis_table_fields;
create TABLE gis_table_fields
(tfield_id INT PRIMARY KEY ,
tabs_id INT,
tfield_name VARCHAR(20),
tfield_alias VARCHAR(128),
tfield_def VARCHAR(5),
tfield_vis VARCHAR(5),
tfield_order VARCHAR(5),
proj_id INT
);
drop TABLE gis_joins;
create TABLE gis_joins
(join_id INT PRIMARY KEY ,
join_fromtab VARCHAR(128),
join_fromfield VARCHAR(20),
join_totab VARCHAR(128),
join_tofield VARCHAR(20),
tabs_id INT,
proj_id INT
);
drop TABLE gis_links;
create TABLE gis_links
(link_id INT PRIMARY KEY ,
link_fromtab VARCHAR(128),
link_fromfield VARCHAR(20),
link_totab VARCHAR(128),
link_tofield VARCHAR(20),
tabs_id INT,
proj_id INT
);
drop TABLE gis_charts;
create TABLE gis_charts
(chart_id INT PRIMARY KEY ,
chart_name VARCHAR(132) NOT NULL,
chart_creator VARCHAR(64),
chart_creation_date VARCHAR(64),
chart_comments TEXT,
tabs_id INT,
proj_id INT
);
The statement drop TABLE is useful for the reorganisation of the database. If you use the parser for the first time, you have to comment out this statement. The tables are in a format for mysql; if you want to use an other database-system, you have to change the structure sligthly.
Please unpack the parser.tar.gz with tar zxvf parser.tar.gz. You will get the following files:
Put the parser.pl in the root directory of your GIS-projects and execute
the script. You will also need PERL. The
parser is written in PERL and uses the UNIX command find. If you want to
test it without find, you can substitute this command by reading from a file.
The file contains in that case the name and the path of all files to scan. it
looks like:
open(FIND, "$parameter_dir/projekt.txt")||die "can't open parameterfile $parameter_dir/projekt.txt\n"; Please comment that line out in the source. For use with mysql you has to do the following two steps:
This program is in a very early version and has many bugs (I believe).
But it is quite useful for our purposes. We want to maintain the program and
would be very happy for suggestions. This software is covered by the GNU
Library General Public License.
You can get this software
Parser
Happy Hacking !
Last modified: Mon Feb 21 14:26:31 MET 2000