1

Spatial database elements

1. Point. Geometric aspect of an object, for which only its location

in space, but not the extent, is relevant.

city

2. Line (polyline). Moving through space, connections in space.

river

cable

highway

3. Region. Abstraction of an object with extent.

forest

lake

city

4. Partitions.

5. Networks (graphs).

Spatial data types

GEOMETRY (abstract superclass)

POINT (a single coordinate, usually but not necessarily 2 dimensional)

LINESTRING (a set of two or more coordinates, with a linear interpretation of the path between the coordinates)

LINEARRING (a linestring of three or more coordinates in which the start and end points are the same, usually not instantiable, but used to build polygons)

POLYGON (a set of one or more closed linearrings, one exterior ring that defines a bounded area, and a set of interior rings that define exceptions (holes) to the bounded areas)

MULTIPOINT (a set of points)

MULTILINESTRING (a set of linestrings)

MULTIPOLYGON (a set of polygons)

GEOMETRYCOLLECTION (a heterogeneous set of geometries)

Simplexes and faces

d-simplex - minimal object of dimension d

Finite set of simplexes such that the intersection of any two simplexes is a face (veidols).

Relational database spatial elements

2D point and cluster

2D lines.

2D polygons.

Object – relational database spatial elements

2D lines.

2D polygons.

DBVS Oracle11g grafikaspamatstruktūras

Layers

In most GIS software data is organized in themes as data layers. This approach allows data to be input as separate themes and overlaid based on analysis requirements. This can conceptualized as vertical layering the characteristics of the earth's surface. The overlay concept is so natural to cartographers and natural resource specialists that it has been built into the design of most CAD vector systems as well. The overlay/layer approach used in CAD systems is used to separate major classes of spatial features. This concept is also used to logically order data in most GIS software. The terminology may differ between GIS software, but the approach is the same. A variety of terms are used to define data layers in commercial GIS software. These include themes, coverages, layers, levels, objects, and feature classes.

Hierarchical structure of spatial data

Spatal element
Geometry
Layers
Coordinate system
Precision

Oracle Spatial data model

Ģeometrisko objektu tips SDO_GEOMETRY un tā elementi (tiek izmantot arī Oracle Spatial)

SDO_ELEM_INFO SDO_ORDINATES

SDO_ SDO_ SDO_

GTYPE SRID POINT SDO_STARTING_OFFSET X1,Y1, X2,Y2, . . .

SDO_ETYPE

SDO_INTERPRETATION

create type SDO_GEOMETRY as object(

SDO_GTYPE number,

SDO_SRID number,

SDO_POINT SDO_POINT_TYPE,

SDO_ELEM_INFO SDO_ELEM_INFO_ARRAY,

SDO_ORDINATES SDO_ORDINATE_ARRAY);

create type SDO_POINT_TYPE as object(

X number,

Y number,

Znumber);

create type SDO_ELEM_INFO_ARRAY as varray(1048576) of number;

create type SDO_ORDINATE_ARRAY as varray(1048576) of number;

IBM DB2 Spatial Extender ģeometrijas objektu modelis

MS SQL Server ģeometrijas objektu modelis

Iekļautiegrafikas datu tipi DBVS PostgreSQL

PostgreSQL grafisko datu apstrādes iekļautās funkcijas

Grafiskās informācijas meklēšana (vaicājumu realizēšana)

Parklājumu veidi (types of intersections)

Ģeometriju predikāti (geometric predicates)

Vaicājumu realizēšanas metodes grafiskajās datu bāzēs

1. Nepārtrauktās aproksimācijas (continuous approximations).

2. Režģa tipa aproksimācijas (grid approximations).

One-Dimensional Embedding of Grid Approximations

Basic idea:

1) find a linear order for the cells of the grid preserving proximity;

2) define this order recursively for a grid corresponding to a hierachical subdivision of space.

z-order, Morton-order

Represent any shape by a set of bit strings, called z-elements

1. Put z-elements as spatial keys into a B-tree B.

2. Containment query with rectangle r:

- determine z-elements for r;

- for each z-element z scan a part of the leaf sequence of B having z as a prefix;

- check theses candidates for actual containment, avoid

duplicate reports.

Universālo DBS indeksi

Grafisko indeksu veidošana (indexes of graphic)

Grafisko objektu telpa (space of graphics)

Ģeometrisko datu indeksu (spatial indexes) tipi

1) Grid (spatial index);

2) Z-order (curve);

3) Quadtree;

4) Octree;

5) UB-tree;

6) R-tree: Typically the preferred method for indexing spatial data. Objects (shapes, lines and points) are grouped using the minimum bounding rectangle (MBR). Objects are added to an MBR within the index that will lead to the smallest increase in its size.

7) R+ tree;

8) R* tree;

9) Hilbert R-tree;

10) X-tree;

11) kd-tree;

12) m-tree - an m-tree index can be used for the efficient resolution of similarity queries on complex objects as compared using an arbitrary metric.

Aproksimējošie taisnstūri (bounding boxes)

R – tree tipa indeksi

The figure above illustrates an R-Tree configuration with 4 sequences.The MBR that covers the spatial data is D to M and MBR created for indexing is A to C.

Let’s create an example where spatial data, which includes a random point, is searched. If the point is in a “within” relationship with D, G or M, then the root to leaf node can be found immediately.If the point is in the area F and J intersects, then in the root node, A will be visited first then return F, then move to root node, select C and return J.This is where the problem lies. The example in Figure 2 only has two tree levels. However, it will take a lot of time to search the tree if there is a lot of data.

These problems have been resolved in R+-Tree.

R+ - tree tipa indeksi

In the figure above, the spatial data configuration from D to M is the same as in R Tree configuration. However, the A and C MBR area is different. In R+-Tree, if needed, the overlapping areas in the same level can be brought from different nodes. You can see that J and D are redundant.

When such redundancies occur, when looking for the area F and J are intersecting, you need only to search in A MBR and do not have to search C.

Pārklāšanās noteikšana (find intersecting shapes)

Grafisko datu datu bāzes sistēma

Populārākās grafiskās datu bāzes sistēmas

1. Oracle RDBMS with Spatial or Locator.

3. PostgreSQL with PostGIS.

4. IBM DB2 with Spatial Extender.

5. IBM Informix with Spatial Blade.

2. SQL Server 2008 with Spatial.

Standartu realizācija grafiskajās datu bāzes sistēmas

Part 2 of Simple Feature Access is implemented to varying degrees in:

1) MySQL Spatial Extensions, although "All of the functions that calculate relations between geometries are implemented using bounding boxes not the actual geometries." MySQL DBMS implements the datatype geometry plus some spatial functions that have been implemented according to the OpenGIS specifications. However, in MySQL version 5.5 and earlier, functions that test spatial relationships are limited to working with minimum bounding rectangles rather than the actual geometries. MySQL versions earlier than 5.0.16 only supported spatial data in MyISAM tables. As of MySQL 5.0.16, InnoDB, NDB, BDB, and ARCHIVE also support spatial features.

2) PostgreSQL DBMS (database management system) uses the spatial extension PostGIS to implement the standardized datatype geometry and corresponding functions.

2) PostGIS extension for PostgreSQL, also supporting some of the SQL/MM Spatial features.

3) SpatiaLite extension for SQLite. SpatiaLite extends Sqlite with spatial datatypes, functions, and utilities.

4) Oracle Spatial, which also implements some of the advanced features from SQL/MM Spatial.

5) IBM DB2 Spatial Extender and IBM Informix Spatial DataBlade. IBM DB2 Spatial Extender can be used to enable any edition of DB2, including the free DB2 Express-C, with support for spatial types

6) Microsoft SQL Server since version 2008, with significant additions in the 2012 version.

Ģeometrisko datu apstrādes funkcijas un operatori

The functions fall into a few basic categories:

1) construction, for building geometries from text and binary representations

2) serialization, for outputting geometries into various text and binary representations (like KML, GML, JSON and SVG)

3) predicates, for testing relationships between geometries and returning true/false answers

4) analysis and measurement, for returning numerical summaries (areas, lengths, distances) about geometries

5) accessors, for stripping out parts from geometries (rings from polygons, points from linestrings, and so on)

6) builders, that take geometry inputs and build new altered outputs (like unions, differences, buffers, convex hulls and so on)

7) aggregates, that take geometry sets and return single resultants, union is the most common

The list of possible functions is very large, but a common set of functions is defined by the OGCSFSQL and implemented by all the spatial databases recommended in this workshop.

Specializētas datu bāzes sistēmas veidošanas varianti

1. Jaunu datu tipu izmantošana(new data types) datu bāzes sistēmās (piemēram, PosgreSQL).

2. Jaunu SQL funkciju izmantošana (new SQL function use)(piemēram, Oracle Analytical function (OVER tipa vaicājumi), datu noliktavas realizēšanas vaicājumi (GROUP by CUBE, Grouping), hierarhiskie vaicājumi).

3. Datu bāzes sistēmas paplašinājuma veidošana izmantojot papildus programmu paketes (extended DBS packages);

- IT firmu produktu izmantošana (piemēram, Oracle Spatial);

- programmu pakešu izstrāde izmantojot datu bāzes servera

programmēšanas valodu(piemēram, PLSQL un Java (Oracle DBVS))

izmantošana.

4. Datu bāzes servera kodola paplašinājumu veidošana(use of cartriges) (piemēram, Oracle cartridges, DB2 data blades, spraudņu (plug-ins) izmantošana).

JGeometry klase[1]

MDSYS.SDO_GEOMETRY JGeometry

java.lang.Objectoracle.spatial.geometry.JGeometry

A Java class that maps Oracle Spatial's SQL type MDSYS.SDO_GEOMETRY.

Provides basic access functions to the geomeries stroed in Oracle Spatial database.

Packages
oracle.spatial.geometry / Provides support for the Spatial SQL SDO_GEOMETRY data type.
oracle.spatial.network / Provides support for the Oracle Spatial network data model.
oracle.spatial.topo / Provides support for the Oracle Spatial topology data model.
oracle.spatial.util / Provides classes that perform miscellaneous operations.
Class Summary
JGeometry / A Java class that maps Oracle Spatial's SQL type MDSYS.SDO_GEOMETRY.
JGeometry.Point / A convenient class that represents a double-typed point.

[1]