You are on page 1of 15

Unit -III

SPATIAL DATABASE
Introduction:

A general-purpose database (often a relational database) which


has been improved to contain spatial information that represents
objects specified in a geometric space as well as tools for searching
and analyzing such data, is known as a Spatial Database.

The depiction of basic geometric objects like points, lines, and


polygons is supported by the majority of Spatial Databases. Some
Spatial Databases can handle more complicated structures, including
triangulated irregular networks, topological coverages, and 3D
objects.

Traditional databases have evolved to manage a variety of


character and numeric data types, but to process spatial data types
effectively, and these databases need additional capability, which is
why developers frequently include geometries or feature data types.
Your spatial dataset can be accessed, stored, and managed with the
help of Spatial Databases.

Nearly all relational and Object-relational Database


Management Systems currently in use have spatial extensions, and a
few GIS software companies have created their own spatial
extensions for Database Management Systems.

Geodatabase:

A Geographic Database, sometimes known as a Geodatabase, is a


Georeferenced Spatial Database that is used to store and modify
geodata or information about a specific place on Earth. Additionally,
the term "geodatabase" can refer to a collection of exclusive
geographic database formats called Geodatabase (Esri).
For instance, a city might connect and use datasets from common
spatial databases for its wastewater department, land registry,
transportation, and fire services.

Characteristics of Spatial Database:

One or more spatial data types that enable the recording of spatial data
as values in a table are the fundamental capability that a spatial
extension to a database adds. Based on the vector data model, a single
spatial value is often a geometric primitive (points, lines, polygon,
etc.). The OGC Simple Features definition for describing geometric
primitives serves as the foundation for most spatial databases' data
types. Raster data can also be stored in some spatial databases. Spatial
Databases must support the tracking and manipulation of coordinate
systems since every geographic place must be described using a
spatial reference system. In many systems, a choice of a coordinate
system is included when a spatial column is defined in a table. This
choice is made from a list of possible systems that are kept in a
lookup table.

The addition of geographic capabilities to the query language (such as


SQL), which gives the Spatial Database access to the exact query,
analysis, and manipulation operations as standard GIS software, is the
second significant functionality extension in a spatial database. This
feature is implemented as a collection of new methods that can be
used in SQL SELECT statements in the majority of Relational
Database Management Systems.

There are Several Types of Operations like:


o Measurement:
Computes geometry distance, polygon area, line length, etc.
o Geoprocessing:
Create new features by changing existing ones, for as by
surrounding them with a buffer or by intersecting features.
o Geometry Constructors:
Specifies the vertices (points or nodes) that define the form to
create new geometries.
o Observer Functions:
Queries that give detailed answers on a feature, like the location
of a circle's center.
o Predicates:
True/false questions about the spatial relationships between
geometries are permissible.

Spatial Index:

Indexes are frequently used in database systems to provide faster and


more effective data access and search. But spatial queries are not a
good fit for this index. Instead, to improve database efficiency,
geographical databases employ something similar to a distinct index
known as a Spatial Index. A system must be able to obtain data from a
vast collection of items without actually searching them all. Hence
Spatial Indexing is crucial. In addition to filtering, it ought to better
allow connections between objects from various classes.

In addition to indexes, geographical databases also provide spatial


data types in their query language and data model. To give a basic
abstraction and represent the structure of the spatial figures with their
related interactions and processes in the geographical environment,
these databases require unique sorts of data types. The system would
be unable to provide the level of modelling that a spatial database
enables without these kinds of data types.

Spatial Query:

A unique kind of sql query supported by spatial databases, especially


geodatabases, is known as a Spatial Query. The queries have a
number of significant differences from non-spatial SQL queries. The
usage of geometry data types, including points, lines, and polygons,
as well as the fact that these queries take the spatial relationship
between these geometries into account, are two of the most crucial
features.

Spatial Data Types and Models


Spatial data is the data collected through with physical real life
locations like towns, cities, islands etc. Spatial data are basically of
three different types and are wisely used in commercial sectors :
1. Map data : Map data includes different types of spatial
features of objects in map, e.g – an object’s shape and
location of object within map. The three basic types of
features are points, lines, and polygons (or areas).
 Points – Points are used to represent spatial

characteristics of objects whose locations


correspond to single 2-D coordinates (x, y, or
longitude/latitude) in the scale of particular
application. For examples : Buildings, cellular
towers, or stationary vehicles. Moving vehicles and
other moving objects can be represented by
sequence of point locations that change over time.
 Lines – Lines represent objects having length, such

as roads or rivers, whose spatial characteristics can


be approximated by sequence of connected lines.
 Polygons – Polygons are used to represent

characteristics of objects that have boundary, like


states, lakes, or countries.
2. Attribute data : It is the descriptive data that Geographic
Information Systems associate with features in the map.
For example, in map representing countries within an Indian
state (ex – Odisha or Mumbai). Attributes- Population,
largest city/town, area in square miles, and so on.
3. Image data : It includes camera created data like satellite
images and aerial photographs. Objects of interest, such as
buildings and roads, can be identified and overlaid on these
images. Aerial and satellite images are typical examples
of raster data.
Models of Spatial Information : It is divided into two categories :
 Field : These models are used to model spatial data that is

continuous in nature, e.g. terrain elevation, air quality index,


temperature data, and soil variation characteristics.
 Object : These models have been used for applications such

as transportation networks, land parcels, buildings, and other


objects that possess both spatial and non-spatial attributes. A
spatial application is modeled using either field or
an object based model, which depends on the requirements
and the traditional choice of model for the application.
Example – High traffic analysing system, etc.
Types of Spatial Queries in DBMS
Any type of spatial data that is data related to location and which
represents objects defined in a geometric space, is stored and
maintained by Spatial Databases. These are used to handle these
Spatial Databases. Spatial database mainly contain representation of
simple geometric objects such as 3D objects, topological coverage,
linear networks and TINs(Triangulated irregular networks).
There are mainly three types of spatial queries as given below.
1. Nearness queries:
It request objects that present near a specified location. A
query to find all Hotels that lie within a given distance of a
given point is an example of a nearness query. The nearest-
neighbor query requests the object that is nearest to a
specified point.
For example, we may want to find the nearest Railway
station. Note that this query does not have to specify a limit
on the distance, and hence we can ask it even if we have no
idea how far the nearest Railway station lies.
1. Region queries:
It deal with spatial regions. For example, a query can ask for
objects
that is present partially or completely within a fixed region.
A query to find all medicine shops within the geographic
boundaries of a given town or we can find all the available
school in a particular city.
2. Union/Intersection:
In this type of queries, we may also request intersections and
unions of regions.
For example, given region information, such as annual
rainfall and population density, a query may request all
regions with a low annual rainfall as well as a high
population density.
In general, there is a combination of spatial and Non spatial
requirements in the queries on spatial data . For example, we may
want to find the nearest restaurant that has vegetarian selections and
that charges less than $10 for a meal.
Since spatial data are inherently graphical, we usually query them by
using a graphical query language. Results of such queries are also
displayed graphically, rather than in tables. The user can invoke
various operations on the interface, such as choosing an area to be
viewed (e.g., by pointing and clicking on suburbs west of
Manhattan), zooming in and out, choosing what to display on the
basis of selection conditions (e.g., hotels with more than three stars),
overlay of multiple maps (e.g., hotels with more than three stars
overlaid on a map representing areas with low crime rates), and so
on. The graphical interface constitutes the front end.
Spatial query methods

A third technique to optimize spatial database queries is to select the


optimal spatial query method for your query. Spatial query methods
are the ways that the database system executes and evaluates spatial
queries, such as using spatial indexes, spatial join algorithms, or
spatial filters. Each spatial query method has its own advantages and
disadvantages, depending on the query complexity, the data
distribution, and the index availability. You should choose the spatial
query method that minimizes the query cost and maximizes the query
accuracy. You can also use query hints or optimizer hints to instruct
the database system to use a specific spatial query method or to avoid
a certain one.
Extensions of SQL have been proposed to permit relational
databases to store and retrieve spatial information efficiently, and
also to allow queries to mix spatial and non spatial conditions.
Extensions include allowing abstract data types, such as lines,
polygons, and bit maps, and allowing spatial conditions, such as
contains or overlaps.

Spatial partitioning and clustering

A fifth technique to optimize spatial database queries is to apply


spatial partitioning and clustering strategies. Spatial partitioning and
clustering are the methods that divide and group spatial data into
smaller and more manageable units, based on their spatial attributes,
such as location, proximity, or similarity. Spatial partitioning and
clustering can improve the query performance and scalability, as they
reduce the data size, the index size, and the query scope. They can
also enhance the data quality and consistency, as they eliminate the
data redundancy, the data skew, and the data anomalies. You can use
different techniques for spatial partitioning and clustering, such as
spatial hashing, spatial binning, or spatial clustering algorithms.
Logical Database
A Logical Database is a special type of ABAP (Advance Business
Application and Programming) that is used to retrieve data from
various tables and the data is interrelated to each other. Also, a
logical database provides a read-only view of Data.
Structure Of Logical Database:
A Logical database uses only a hierarchical structure of tables i.e.
Data is organized in a Tree-like Structure and the data is stored as
records that are connected to each other through edges (Links).
Logical Database contains Open SQL statements which are used to
read data from the database. The logical database reads the program,
stores them in the program if required, and passes them line by line
to the application program.

Features of Logical Database:


In this section, let us look at some features of a logical database:
 We can select only that type of Data that we need.

 Data Authentication is done in order to maintain security.

 Logical Database uses hierarchical Structure due to this data

integrity is maintained.
Goal Of Logical Database:
The goal of Logical Database is to create well-structured tables that
reflect the need of the user. The tables of the Logical database store
data in a non-redundant manner and foreign keys will be used in
tables so that relationships among tables and entities will be
supported.
Tasks Of Logical Database:
Below is some important task of Logical Database:
 With the help of the Logical database, we will read the same

data from multiple programs.


 A logical database defines the same user interface for

multiple programs.
 Logical Database ensures the Authorization checks for the

centralized sensitive database.


 With the help of a Logical Database, Performance is

improved. Like in Logical Database we will use joins


instead of multiple SELECT statements, which will improve
response time and this will increase the Performance of
Logical Database.
Data View Of Logical Database:
Logical Database provides a particular view of Logical Database
tables. A logical database is appropriately used when the structure of
the Database is Large. It is convenient to use flow i.e
 SELECT

 READ

 PROCESS

 DISPLAY

In order to work with databases efficiently. The data of the Logical


Database is hierarchical in nature. The tables are linked to each other
in a Foreign Key relationship.
Diagrammatically, the Data View of Logical Database is shown as:
Points To Remember:
 Tables must have Foreign Key Relationship.

 A logical Database consists of logically related tables that

are arranged in a hierarchical manner used for reading or


retrieving Data.
 Logical Database consist of three main elements:

 Structure of Database

 Selections of Data from Database

 Database Program

 If we want to improve the access time on data, then we use

VIEWS in Logical Database.


Example:
Suppose in a University or College, a HOD wants to get information
about a specific student. So for that, he firstly retrieves the data
about its batch and Branch from a large amount of Data, and he will
easily get information about the required Student but didn’t alter the
information about it.
Advantages Of Logical Database:
Let us look at some advantages of the logical database:
 In a Logical database, we can select meaningful data from a

large amount of data.


 Logical Database consists of Central Authorization which

checks for Database Accesses is Authenticated or not.


 In this Coding, the part is less required to retrieve data from

the database as compared to Other Databases.


 Access performance of reading data from the hierarchical

structure of the Database is good.


 Easy to understand user interfaces.

 Logical Database firstly check functions which further check

that user input is complete, correct, and plausible.


Disadvantages Of Logical Database:
This section shows the disadvantages of the logical database:
 Logical Database takes more time when the required data is

at the last because if that table which is required at the


lowest level then firstly all upper-level tables should be read
which takes more time and this slows down the
performance.
 In Logical Database ENDGET command doesn’t exist due

to this the code block associated with an event ends with the
next event statement.
Deductive Database Semantics and Query Evaluation
e classify the relation in Datalog Program or deductive database as
either output relation or input relation. output relations are defined
by rules and input relations have a set of tuples explicitly listed (e.g.
assembly) given the instance of the input relation we must compute
instances for the output relations.
The major advantage of a deductive database is the ability to write
queries. we can understand deductive databases more easily using
the following diagram.

deductive database
The meaning Datalog programming usually defines deductive
database in two different ways both of which essentially describe the
relation instance for output relation. technically a query is a section
over one of the output relations. however, the meaning of the query
is clear once we understand how relation instances are associated
with output relation in Datalog Program
Safe Datalog Programmer
There are many approaches to defining the semantics of the Datalog
Program:
Least model semantics
 This model gives users a way to understand the Program

without thinking about how that Program will be executed.


 This semantics is declarative works like relational calculus

and not practical like relational algebra semantics.


 It is comparatively simpler due to recursive rules making it

difficult to understand the Program in terms of evaluation


strategy.
Least fix point semantics
 least fix point semantics will give a conceptual evaluation

strategy to compute the relation.


 It works as the basis for recursive query evaluation.

 The efficient query evaluation strategy is used in actually for

better implementation.
 The correctness of the model is demonstrated by equivalence

to the least fixed point approach.


Altogether, the main objective of this thesis is to improve existing
transformation-based methods and to develop new ones for
evaluating ratifiable as well as unsatisfiable recursion. The results
ought to provide a realistic framework of
efficient evaluation techniques for extending existing relational
database systems.

Query Evaluation for Deductive Database


The query evaluation for the deductive database is as follows:
phase 1: storage and access
 The deductive database stores rules and facts on datalog

formulas in clausal form


 It contains quantifiers like existential and universals
 Clausal forms of the formula are made up of a number of
clauses each clause is composed of a number of literals
connected by OR logical connection or AND logical
connection
phase2: interpretation of rules
 The deductive database then interprets all rules using various

methods.
 Interpretation of rules the fact is considered as axioms. Rules

are also called deductive axioms and are used to construct a


proof that derives new facts from existing facts.
 Another method of interpretation we have given is an

infinite domain of constant values with an assigned predicate


for each combination of values for an argument.

Deductive Database Prototype

There are many deductive prototypes are available many such


systems are memory based. it assumes all required permanent
relations are stored in the main memory and during the computation
process, temporary relations generated can be stored in memory.
for example RDL/c and megalog.

You might also like