![]() Database Query
This page presents a
general view of relational databases emphasizing the relationship between SPRING
and a relational database management system (RDBMS) such as CODEBASE, ACCESS,
MYSQL, POSTGRESQL and ORACLE. When a database is first
created in SPRING, the user should define which DBMS he will be using. For CODEBASE,
the tables are compatible with DBase 4 format, extensions*.dbf.
For ACCESS (Microsoft), all tables are kept in a single "spring.mdb" file. For MYSQL, POSTGRESQL and ORACLE, the tables are stored inside
its manager and the user must have permission to create and update his own
tables. To better understand the
application of tables in each data category and object, the user must be
familiar with the SPRING Conceptual Model .
Relational Databases
The principles of the
relational structure were first presented by Codd
in 1972, who realized that the discipline and <lot id, owner,
address, area, tax >
A relationship can be
represented using a table. Check the example below where a table shows the
relationship of an urban cadastre with its attributes and values:
Codd
suggested a set of operations
over the relationships called relational
algebra which included operations of projection, selection, union, intersection and cartesian product. He also showed that
these operations were closed, i.e., the application of one of them always
generates another relationship. The relational model has
proved to be very useful to deal with commercial and administrative
applications. Nowadays it is a wide known technology whose strict formulation
has allowed the definition of a standard language for queries called SQL (Structured Query Language). In the IBM-PC
environment, most database management systems also follow this relational
standard, including DBASE, ORACLE and ACCESS. Geo-Relational Data Model
The RDBMS (Relational
Database Management System) is the link between a geographic information
system and a relational database. It is also called a geo-relational model
where the spatial and descriptive components of the
Relational DBMS and SPRING
SPRING has been conceived
as a geographic database and was, since the beginning, projected to operate
efficiently with a DBMS, using a geo-relational data model (as described above). We define here a
geographic database as a repository of GIS data, storing geographic data in
different geometries (images, vectors, grids) as well as descriptive
information (non-spatial attributes) that are stored in tables inside the
database. Nowadays, the native
databases management systems available are: CODEBASE (compatible with
DBASE IV), ACCESS (Microsoft - it is necessary to have the manager
installed or the JET drives (3.4 or 4.0 - required libraries so SPRING can
create a *.mdb database), MYSQL, POSTGRESQL
and ORACLE (these three must be provided by the user - installed
remotely or locally). The MYSQL, POSTGRESQL and ORACLE database manager must be purchased separately by
the user. The use of the DBMS is controlled from the creation of a database
on SPRING. NOTE 1: The Access manager is available
only for the SPRING Windows version. NOTE 2:
The POSTGRESQL manager is available for the SPRING Windows and Linux version.
Geo-Fields and Geo-Objects Attributes
In SPRING, each category of
geographic data is associated to a table, that
contains attributes describing the data types. Each geo-object and geo-field
receives a unique identifier (the "geoid"),
which is maintained by the system and should not be changed by the user. The current RDBMS
(defined when the database is created inside SPRING) is used to store all
descriptive attributes and tables and can be visualized externally using the
appropriate management system. Input of Geographic Data Attributes
The definition of
geographic data attributes is described in detail at SPRING
Conceptual Model.
Generally, each category can be associated to a relationship expressed in a
table. The button "Attributes..." (after choosing the option File - Data Model on the main menu) allows the
input of attributes from the associated table. In case of Thematic Maps,
each thematic class (geo-class) can be associated to a relationship (table). To include an external
table in the SPRING database, you have to create or import it to a
non-spatial model and then associate it to an object table. See how to edit non-spatial
data and how
to link tables. The next examples
illustrate the association of attributes to geo-fields and geo-objects in
SPRING. Image Attributes - Example
We can associate
attributes to categories coming from IMAGES, to create, for example, a
satellites image catalog of your institution. Then, we can associate to each
image, information such as: satellite, sensor, date, orbit/point ("World
Reference System" - WRS) and correction. The table below presents this
set of attributes:
Thematic Maps Attributes - Example
Consider a thematic map
that contains a category called SoilsMap that contains the
maps of soil from a national database. Then, the specialist might want to
associate to each map, some information such as: survey date, person in
charge and institution:
Note that this table is
related to maps from the category SoilsMap and it
can be used to store information related to the maps as spatial entities. SPRING
also allows the association of tables to classes that are associated to
thematic maps. It is possible to have a single table for all classes. Considering the example
above, we might want to determine properties that are common to all thematic
classes such as: ph, Aluminum proportion, Nitrogen, Potassium and humidity. The
table below shows and example of attributes for the classes associated to the
category SoilsMaps.
Cadastral Maps Attributes - Example
To illustrate cadastral
maps and geo-objects let's consider an example of a map of lots in a city. Suppose
we create two categories: Lots
(Object) and LotsMap (Cadastral).
In the case of lots, the
associated information could be: registration number, owner name, lot size
and tax paid. Since we are dealing with a geo-object that has geographic
location, SPRING automatically associates to each table input a unique
identifier for each geographic object. Example of attributes for
"Lots"
The elements for LotsMap
category could have the following attributes: map number, region of the city,
map scale and survey date as shown below:
Network Maps Attributes - Example
A network map is similar
to a cadastral map since they both deal with objects, however in the form of
lines and points. Let's take an example of a map of roads in a city and
suppose the creation of two categories: Roads (Object) and RoadsMap (Cadastral). For Roads, the associated
information could be: registered number, number of tracks, width, type of
asphalt, value in meters. Since we are dealing with a geo-object that has
geographic location, SPRING automatically associates to each table input a
unique identifier for each geographic object. Example of Attributes for
"Roads"
NOTE: The definition of flow
parameters (impedance) and demand for each network segment must be done when
the map is being edited. Geo-Objects Attributes
In SPRING, the
geo-objects are defined independently from their graphic representation and
if you want to link them to their representations you have to execute some
step: 1.
On the main menu, click on File - Data Model...
(
2-
In " Categories" define the attributes associated to the Lots table. 3.
Define a category of Cadastral model (Name:
Urban_Cadastre). 4.
Choose on the main menu Edit - Infolayer...
and create an IL (for
example Lots_Map), from the category Urban_Cadastre. Digitize the lines (see
how to
digitize) that
contain the boundaries, adjust the lines and create the polygons. 5.
Associate, by pointing, the polygons of the objects map (Cadastral
Objects Identification). In our example, we need to associate polygons of the Lots Map (see
figure below). 6. Fill in the
objects attributes (lot) at the window " Attributes Values" that can be accessed when
you click on Attributes..., "Object Edition" window (Edit - Object... on the main menu). Check How to edit objects.
Cadastral Objects Query
For map visualization the
user should use the options available at the "Control Panel"
(see more details on how to operate the Control Panel). There the user will find some
options for controlling the exhibition of images, thematic maps and digital terrain models. However when we have object maps (cadastral or
network), the "Control Panel" only controls the selection of
IL and all objects inside them, not allowing the objects analysis in terms of
attributes and spatial relationship. In SPRING, the resources
for query on cadastral and network maps go beyond the simple presentation of
objects category. It is possible to perform a query considering the
descriptive attributes of objects (for instance, "Show all high schools that have more than 1500
students" - the attributes school level and number of students are inside the table of the
object school) or spatial relationship (for instance, "Which schools are
inside the Ipiranga district and are located The manipulation of the
geo-objects table might become slow when the data volume is high. To solve
this problem, you can create an objects
collection by extracting from the table only the objects of
interest and creating an auxiliary table. For example, the user can create a
collection of polygons (Lots) with tax value greater than R$1500, and from
this new table perform other queries.
Query Models
The query on a map of
objects starts with a selection on the "Control Panel" followed by the creation of an Object Collection and Visualization
Control.
From the Visualization Control, you can access the modules Query, Spatial Query, Grouping and Table. With the objects on the
Visualization Screen, you can process a query on the Attributes/Images/URL
module. Using the Table module you will be able to save its content, generate
other collections or thematic plans. The figure below shows the relationships
among these modules, as well as the possible paths you can follow when
processing a query on its objects. Observe that there is a
dependency and an order to be followed in the query modules.
First Steps to perform a query on a cadastral map
Cleaning previous queries
After exiting SPRING, the
system always stores the last query performed. It is possible to clean all
modules or select a specific one. The options are the
following:
![]() |