Oracle's Spatial Database

Source: Internet
Author: User
Oracle's Space database: 2007-12-21 16:31:12

Category: Oracle

For a simple study,

Collection

See below for more information [@more @]
1. What is Oracle's spatial database:

Oracle's spatial database provides a set of SQL schemas and functions on how to store, get, modify, and query spatial datasets.
Spatial data consists of the following:
1.MDSYS Schema: storage, syntax, and semantics that specify the supported geographic data types
2. Spatial data indexing mechanism
3. Provides operators, functions and processes for spatial intersection queries, spatial joint queries and other spatial analysis operations
4. Provide functions and procedures for general tooling operations and performance operations
5. Topological data model for processing points, edges and faces
6. Network data Model for the dot-line representation of the network
7. Ground Ricoh Grille: A set of mechanisms allows users to store, index, query, analyze and publish raster data, shifting raster graphs, raster data and their meta data

1.2 Object Relational Model
Spatial supports object relational models to represent geographic data. The model uses Oracle native space data type sdo_geometry to correspond to a geographical data object. An Oracle table can have one or more sdo_geometry fields. Object Relational model uses SQL With Geometry Tpes "to implement the geospatial data features defined by the Open GIS odbc/sql specification.
The benefit of the object relational model is that:
1. Support for many geographic types, such as arcs, circles, combined multilateral, combined segments and optimized rectangles (this I don't know what it means yet)
2. Easier to build and maintain indexes, and easier to optimize the performance of spatial queries
3. Index maintained by Oracle Database
4. Geographic information can be placed in a field
5. Specially optimized performance
1.3 Spatial Data Introduction
Oracle Spatial is designed to make spatial data management easier, and more natural to users of location-enabled applications and geographic information sy Stem (GIS) applications (this paragraph really do not know how to translate). Once the spatial data is stored in an Oracle database, it can be easily maintained, acquired, and established to correlate with other data stored in the database.
A typical example of spatial data is the road map. A road map is a two-dimensional object that includes dots, lines, and polygons to
Show towns, roads, public boundaries (such as country or province). A road map is a visual way of expressing geographic information, towns, roads and public side
These objects on the Earth's surface are mapped to a two-dimensional display or paper, preserving their relative position and relative distance.
The location of these objects in the Earth data (such as latitude and longitude) is spatial data. When the map is rendered, these spatial data are used in two-dimensional paper
Locates the position of an object on the GIS is often used to preserve, retrieve and present these geographical correlations (Khan, this ...) of spatial data.

Another spatial data that can be stored in spatial (as opposed to GISR spatial data) is the spatial data of CAD and CAM. They work within a relatively small range of data and are often used in automotive design or circuit board design.

The difference between the two systems is the data size and the precision of the data, not the complexity of the data. The system can have the same number of data points. In a geographical dimension, a local bridge may be only more than 10 inches without any visible problems with the representation of the road building, but for the diameter of an engine piston, an error of more than 10 inches can cause the engine to fail.

On the other hand, the complexity of the data is independent of the size of the region that is performing it. For example, a printed circuit board, which may have thousands of etching objects, the complexity of the information contained in this area may be higher than a road blueprint.

(A piece of nonsense, do not translate, the following with)

1.4 Geometrical types
A geometric type is composed of a sequential sequence of vectors connected by a line or curve. Its semantics are defined by its type. Spatial supports several native types, and geometric types can be formed by combining these native types. Native types include:
Two-dimensional type:
1. Points and points of the set
2. Line segment
The multilateral type of 3.N point combination
4. Curve segment (all curves are made up of arcs)
5. Arc-Type Multilateral type
6. Combined Polygon
7. Combined segment
8. Round
9. Optimized Rectangle
Two-dimensional points are represented by two coordinates (X,Y), often representing latitude and longitude. A segment is a combination of one or more point pair-defined fragments. A composite polygon is a closed ring region formed by a plurality of connected segments. For example, a point can represent a building's location, a segment can represent a road or runway, and a polygon can represent a country, a city, a restricted area, or a block.
Self-intersection polygons are not supported now, but the self-intersection segments are supported. If a segment is cross-linked, it cannot form a polygon. A self-delivered segment does not contain any regions.
Spatial also supports the preservation and indexing of three-and four-dimensional geographic types, in which three or four coordinates define a vector. However, space functions (except for LRS functions and MBR-related functions) work only in two-dimensional space, and all space operators (except Sdo_filter) cannot work on more than two-d spatial indices.

1.5 Data Models
Spatial data model is a hierarchical structure composed of elements, geographical objects and layers. A layer consists of multiple geographical objects, and a geographical object consists of multiple elements.
1.5.1 Element

An element is the basic module that makes up a geographical object. The space element types supported now are dots, segments and polygons. For example, an element can simulate a constellation (a set of points), a path (a set of segments), and a national boundary (a collection of polygons). The coordinates of each element are saved as x,y pairs. The outer circles and inner circles of a polygon are considered to be two separate elements, but are combined into a complex polygon.
The point data is formed by a coordinate, and the line data is represented by two coordinates, and the polygon coordinates are composed of a sequence of coordinates.
1.5.2 Geographical objects
A geographical object is a description of a spatial object, which is composed of several sequential elements. A geographic object can be a single element, or it can be a combination of multiple isomorphic and heterogeneous elements. In a composite polygon, such as a set of small islands, is a homogeneous set. A heterogeneous set is composed of different types of elements, such as dots and polygons.
For example, a geographical object representing a land for construction, it may appear as a polygon, with a hole in the middle that represents the surface or the partition of the building.
1.5.3 Layer
A layer is a collection of geographic objects with the same attributes. For example a GIS layer can include terrain data, population density, road and bridge networks. For a single layer, the geographical objects and corresponding spatial indices that it includes represent a separate table in the database.
1.5.4 coordinate system
A coordinate system (also called a Space Reference system) is defined to represent the coordinates of a position and to establish a relationship between two coordinate sets. It can be interpreted as a set of coordinates to represent a set of positions in the real space.
Any spatial data is related to the coordinate system. A coordinate system can be geographically related (related to a coordinate system on Earth) or a geo-related (such as a Cartesian coordinate system unrelated to the actual coordinates on earth). If a coordinate system is geographically related, it will have a default unit of measurement (such as meters), but you can use spatial to automatically convert to other units of measurement (such as kilometers).
Before Oracle Spatial release 8.1.6, a Geographic object (Sdo_geometry) is saved as a string of coordinates, not associated with any particular coordinate system. Spatial function and operator always assume that the coordinate system is from Cartesian orthogonal coordinates, so it is often impossible to provide correct geo-longitude coordinate. With the release of 8.1.6, spatial provides support for a number of coordinate systems to facilitate the free conversion between the various coordinate systems.
Spatial data-supported coordinate systems include:
Cartesian coordinate system: If the geographic object does not specify the coordinate systems, the default is the Cartesian coordinates.
Geodetic coordinate system: Also known as geographical coordinates, is an angular coordinate systems, closely related to spherical pole coordinates.
Project coordinate system: is a plane cartesian coordinate systems, used to map the Earth's surface points to a plane by mathematical mapping. There are various mathematical mapping methods, each of which has its own purpose.
Local coordinates: a Cartesian coordinate system, such as a CAD drawing, that corresponds to a geo-related coordinate systems.
When working with a geographic object, spatial either uses Descartes or a curve calculation model (such as a full space coordinate system).
1.5.5 Tolerances
Tolerances are related to the accuracy of spatial data. The tolerance reflects the distance between two measuring points that can represent the same object. The tolerance value is a positive number greater than 0. The unit of this value depends on whether it is related to a geographic coordinate system.
For a geographical data, the tolerance value is a value in meters. The tolerance value cannot be less than 0.05 (five mm), of course it is greater than this value in most cases. If you specify a value that is less than this, spatial uses 0.05 as the actual value to save.
For a non geographic data, the value of the tolerance in one unit is associated with the actual coordinates. For example, if the unit of measurement is kilometer, a 0.005 tolerance means 0.005 km, and 2 of the tolerance means 2 km.
In all practical use cases, smaller tolerance values represent more accurate data.
Tolerances are particularly used in two areas:
1. Define the geographic metadata of the layer
2. As a function of the input parameters.
The use of 1.5.5.1 tolerances in the geo-metadata of a layer
The dimension information for the layer contains the tolerance information. Each dimension of the Diminfo field in the Xx_sdo_geom_metadata view contains a sdo_tolerance value, and the value is the same in the same layer.
If a function accepts an optional tolerance parameter, and the parameter is null or unspecified, then the sdo_tolerance of the Layer object is used. Examples of actual use such as: the distance between Cola_b and Cola_d is 0.846049894. If a sdo_geom. When the Sdo_distance function calculates the distance between the two points without specifying a tolerance, it relies on the sdo_tolerance value of the layer on which the point resides. For example
1. If the Sdo_tolerance value is 0.005, then this function returns 0.846049894.
2. If the Sdo_tolerance value is 0.5, then this function returns 0. Returns 0 because the function first creates a 0.5 circle around the two points of Cola_b and Cola_d, because the two circles intersect, so the two points are 0.


You have two ways to select a sdo_tolerance for a layer:
1. When querying the distance of two objects, it is appropriate to reflect the value of the precision of the distance. For example, two non-geo objects should be considered two objects when they are 0.8 units away, then the sdo_tolerance should be less than 0.05.
2. Values should reflect the measurement accuracy of the geographic objects in the layer. For example, if all geographical objects in a layer are used as integers and two geographical objects of 0.8 units of distance are treated as one object, then sdo_tolerance 0.5 is appropriate.

For geo-data, a second method is generally used, using the highest-precision sdo_tolerance. For example, if a geographic object uses an integer unit, then the appropriate value should be 0.5; therefore, if the geographic object is defined to use a 4-bit decimal (for example, 31.2587), then the appropriate value is 0.00005.

1.5.5.2 as input parameter
In many spatial functions, tolerance parameters are accepted to override the default layer tolerance values.

1.6 Query Model
Spatial uses a two-tier query model to solve queries and spatial filtering problems. The model uses two different purpose operations to speed up the query process. The result of the output is the combination of the two operations.
These two operations are primary and secondary operations
1.primary filtering operations: Use of geographically approximate query operations to reduce computational complexity. Because this query is approximate, it produces a relatively large result set, which is used for secondary filtering operations.
2.secondary filtration Operation: In the result set filtered out by the primary, the result set is filtered to the final precision by using the exact calculation. Because this computational process is very expensive, it is only computed on the result set filtered by primary.
Spatial index is used to implement primary filtering. Spatial does not insist on using primary and secondary filter combinations. In many cases, a primary filter is sufficient. For example, in a magnification operation, the application simply gets the contents of the geographic area that intersects a rectangular box. At this point, the primary filter can return a large collection very quickly, and the application can use the cut path to show only the target area.

1.7 Spatial Data Index
The spatial index provides two main features:
1. Find the space object in one area.
2. Find the intersection of two space objects.

Oracle Spatial uses the R-tree index (for Quadtree because it has not been encouraged to use, so the part of it is not turned over).
1.7.1 R-tree Index
Spatial R-tree Index can locate four dimensional space. An r-tree index approximates the use of a single MBR to represent a geographic object. It is stored in the Space Index table (user_sdo_index_metadata view of the sdo_index_table field refers to the Space index table, if you find that field content, you will see only a bunch of binary). The R-tree index also maintains a sequence object (the Sdo_rtree_seq_name field in the User_sdo_index_metadata table).

The quality of 1.7.2 R-tree
The insertion and deletion of the R-tree index actually affects the quality of the r-tree, thereby affecting the performance of the query.
R-tree are hierarchical tree structures that have different heights in different branches. Its performance is largely dependent on the distribution of query area and the height of tree nodes. LEVEL0 (the 0-layer actually refers to the leaf node) includes the MBR of the particular object. The LEVEL1 is the MBR that contains all the leaf nodes. The original ratio of the "area" at the "topmost level" to the "area" at level 0 can change over time BasedOn updateds to The table (not very clear what it means, the ratio of the area to which the root node points to and all the leaf nodes) varies according to the update of the space table. So if this index degrades, rebuilding will be a good way to raise performance.
If a large number of inserts, updates, and deletions have been made, and sdo_filter performance degradation, the performance degradation of this method can be attributed to the quality degradation of the R-tree index. Can pass Sdo_tune. Quality_degradation to check the degree of degradation, and if the function return value is greater than 2, consider rebuilding the index. If the R-tree index degradation is not serious, then query performance degradation can be considered whether the Oracle cache ah, I/O ah, such as the setup problem.
Reconstruction R-tree can use the ALTER INDEX rebuild statement.

1.8 Spatial relations and filters.
Spataial uses secondary filters to determine spatial relationships. Spatial relationships are determined by geographical location. The most common spatial relationships are based on topology and distance.
To determine the spatial relationship, Spatail has many secondary filters:
The 1.sdo_relate operation indicates a topological relationship. It has implemented nine overlapping models in the point, the line and the polygon Middle classification two spatial objects topological relations, each object has contains, overlaps and does not contain three kinds. The boundary between the dots and lines separates the interior from the outer. The boundary of a segment is made up of its two endpoints, and if its endpoints overlap (sweat, then not a point), then it is a line segment with no boundaries. The boundary of a multiline segment is made up of the endpoints of each of its constituent segments. The boundary of a polygon consists of the segments that describe it. The interior means that all the points that make up the object are within another object, not coincident with the boundary, and the external is exactly the opposite.
The 2.sdo_within_distance operation determines whether two space objects are within a specified distance.
The 3.sdo_nn action indicates the object closest to a space object.
Spatial uses the following names to represent the topological relationships of space objects:
1.DISJOINT boundary does not intersect with interior
2.TOUCH boundaries intersect, but internal does not intersect
3.OVERLAPBDYDISJOINT the interior of an object intersects with the inner boundary of another object, but the boundary does not intersect. For example, the starting point of a line is outside the polygon, but the end point is inside the polygon.

4. Overlapbdyintersect the boundaries of two objects overlap with the interior
5. Equal two objects have the same bounds with the interior
6. Contains the boundary of an object with the interior completely contained within another object
7. Covers if the interior of an object is contained within or at the boundary of another object, and their boundaries overlap
8. Inside in contrast to contains, a inside B indicates B contains a
9. Converedby In contrast to Convers, a converedby b indicates b convers a
On when an object's interior and bounds are on the boundary of another object, for example, a segment is on the boundary of a polygon.
11. Anyinteract two objects have any above intersect

The sdo_within_distance operator determines whether two objects are within a specified distance. This action creates an area around the B object that is a specified distance, and then see if a is intersecting with the area.
The SDO_NN operation returns a specified number of recent objects around an object.
1.9 Space operations, processes and functions
The spatial Pl/sql application interface contains multiple operations and many processes and functions.
Spatial operations, such as Sdo_filter and sdo_relate, provide better performance because they use a spatial index. The spatial operation can only be used in the WHERE clause of the query statement. The first argument is the geometry field of the space object, and the second parameter specifies a query window (. Khan, it seems to have seen the operation of the instructions to turn over better.
Spatial processes and functions use PL/SQL packages to provide functions such as Sdo_geom, Sdo_cs, and Sdo_lrs. These subroutines do not require a spatial index or use a spatial index (Khan). These subroutines can be used in the WHERE clause or in any subquery. The two geographical objects that are parameters should have the same coordinate system.
Accept the tips for using these actions, procedures, functions with respect to performance:
1. If the comparison operation, and if there are operators to suit your needs, please use the operator first. For example, replace Sdo_geom with Sdo_relate. RELATE, use sdo_within_distance instead of Sdo_geom. Within_distance.
2. For the operator, always use the uppercase TRUE, for example = ' true ' instead of <> ' FALSE ' or = ' true '.
3. For the operator, if the query window to its own table, then use/*+ ORDERED * * to optimize performance.
1.10 Spatial Aggregation functions
An Oracle space aggregate function acts on a geographic object that is queried by SQL. The spatial aggregation function returns a Sdo_geometry geographic object. For example, SELECT sdo_aggr_mbr (SHAPE) from Cola_markets returns the MBR of all geographical objects in this table.
The Select Sdo_aggr_union (Sdoaggrtype (C.shape, 0.005)) from Cola_markets C WHERE c.name< ' cola_d '; A collection of all geographical objects other than D.
All geographic types that can use spatial aggregation should define a 4-bit sdo_gtype value.
1.10.1 Sdoaggrtype Object Type
Many spatial aggregation functions accept sdoaggrtype types as parameters.
Create type Sdoaggrtype As Object (
Geometry sdo_geometry,
tolerance number);
The tolerance value in the Sdoaggrtype type is generally the same as the sdo_tolerance value of the geometry, unless there is reason to require a different value.
1.11 Geocoding
Geocoding is the process of translating address data from a table into a standard address data. The result of the geocoding process is a theodolite to locate the input address.
1.12 Space Java Application interface
Oracle Spatial provides a JAVAAPI, which includes:
1.oracle.spatial.geometry: Provides spatial support for sdo_geometry types.
2.oracle.spatial.network: Provides Oracle spatial network data Model support.
3.oracle.spatial.topo: Provides Oracle spatial topology data model support
4.oracle.spaital.util: Provides a variety of space operations
1.13 Mddata Schema
This chapter does not know what to say, does not turn
1.14 Performance and Tuning
Many factors can affect the performance of Oracle spatial applications. For example, use optimization hints to affect the query plan.
1.15 OGC
1.16 Spatial Release (Version) number
This chapter is boring and teaches you how to look at spatial's version number. SELECT sdo_version from dual;
Hardware requirements for 1.17 spatial application
Error message for 1.18 spatial
The spatial error message number is between 13000 and 13499.
An example of 1.19 spatial
Oracle Spatial is an example, under the $oracle_home/md/demos/examples

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.