[Oracle spatial series] sdo_geometry (zz)

Source: Internet
Author: User
Tags first string
In ArcGIS, data is stored in Oracle using SDE, including binary long raw, ESRI st_geometry, and Oracle Spatial-based sdo_geometry. <Updoogis original>

The advantages and disadvantages of these methods are not the main research direction. We can get help through ArcGIS Server help in ArcGIS. Here we will mainly learn about the storage method based on Oracle Spatial. The field type of the geometric column shape is MDSYS. sde_geometry.

The sdo_geometry type defined by Oracle Spatial is:
Create type sdo_geometry as object (
Sdo_gtype number, // The first string is the field name, and the subsequent string is the field type
Sdo_srid number,
Sdo_point sdo_point_type,
Sdo_elem_info sdo_elem_info_array,
Sdo_ordinates sdo_ordinate_array );

Here, sdo_geometry as object identifies this type as the object type. In the beginning, we can think about it as a geometry object in ArcObjects (the object in the shape field of the original element is geometry), rather than understanding how it is organized. The sdo_point_type, sdo_elem_info_array, and sdo_ordinate_array of this type are also the same as those of Oracle Spatial and sdo_geometry.

The following describes the parameters of the sdo_geometry type:

1. sdo_gtype: indicates the geometric type to be stored, such as the DOT/line surface. It is expressed by the number type;

2. sdo_srid: geometric space reference coordinate system. The type is also number;

3. sdo_point: if it is of the geometric type, the point coordinate is stored; otherwise, it is null. The sdo_point_type customized by Oracle;

4. sdo_elem_info: defines how to understand the coordinate strings in sdo_ordinates;

5. sdo_ordinates: stores the actual coordinates separated by commas (,), x, y, and different points;

The following describes the meanings of these field parameters.

I. sdo_gtype

The sdo_gtype value is composed of four digits in the format of dltt.

Where, D indicates the geometric dimension. For example, D = 2 and D = 3 for two and three dimensions;

L defines lrs. Generally, L = 0;

TT defines the type of geographic object. Now we use from 00 to 07. For example, TT = 01 indicates a single point;

The following is the two-dimensional geometric type of T = 2. The sdo_gtype parameter value is specific, as shown inFigure 1:

For a given layer, all geographic objects must be in the same dimension, and 2D and 3D data cannot be placed in one layer.

Ii. sdo_srid

Sdo_srid defines the spatial coordinate reference system. If sdo_srid is null, no coordinate system is specified. If sdo_srid is not null, its value must be in MDSYS. the SRID column in The cs_srs table has a corresponding value, and its value must be inserted into the user_sdo_geom_metadata view.MDSYS. cs_srs tableReferenceFigure 3

Iii. sdo_point

The construction method of the sdo_point type is: sdo_point_type (x, y, z), where the types of X, Y and Z are double and Int.

The sdo_point field is defined as the sdo_point_type that contains the X, Y, and Z attributes. If the geometric type is point, the values of sdo_elem_info and sdo_ordinates are null and sdo_point are not empty. In other cases, sdo_point is ignored by spatial, that is, set to null. If this layer only has vertex objects, we recommend that you store them in the sdo_point attribute. The sdo_point_type is defined as follows:

Create type sdo_point_type as object (
X number, // X coordinate value
Y number, // y coordinate value
Z number); // zcoordinate Value

Iv. sdo_elem_info

The construction method of the sdo_elem_info type is: sdo_elem_info_array (A, B. C), where A and B. C are of the number type.

Sdo_elem_info is the key and difficult point for understanding and understanding sdo_geometry. sdo_elem_info defines how to understand the coordinate string attribute in sdo_ordinates.

Each three numbers of sdo_elem_info are combined into an sdo_elem_info attribute unit (For details, refer to the following example ).

Each sdo_elem_info attribute unit consists of sdo_starting_offset, sdo_etype, and sdo_interpretation.The following describes the meanings of the three numbers:

4.1. sdo_starting_offset: Declares the sequence numbers of the first coordinates that constitute the current geometric fragment in the sdo_ordinates array. The coordinate sequence number starts from 1 rather than 0. Here, sdo_ordinates is the coordinate sequence in sdo_geometry. The coordinate sequence is a number separated by commas. The specific calculation is as follows: sdo_ordinate_array) if the geometric fragment starts with '6', the coordinate number sdo_starting_offset = 3. (For details, refer to the following example)

4.2. sdo_etype: Declares the element type. Can be combinedSdo_starting_offset and sdo_etypeTable to understand.

The sdo_etype value is 1, 2, 1003, or 2003, indicating that the ry is a simple ry. The coordinate sequence in sdo_ordinate_array can be understood by the sdo_elem_info attribute unit, namely, three numbers separated by commas.

Note: sdo_etype value = 1003. If the geometric type is surface, it is an outer polygon ring (in a counterclockwise order)

Sdo_etype value = 2003. If the geometric type is plane, it is an inner polygon ring (clockwise)

The sdo_etype value is 2005 or, indicating that the ry is a combination element. Generally, the first three-digit group is not the sdo_elem_info attribute unit, but to describe the information of the combination element. For details, see the followingComplex Multi-definition lineAndComplex Polygon.

4.3. sdo_interpretation: There are two possible meanings: whether sdo_etype is a combination element. If the sdo_etype value is 4, 2005 or, how many combinations are identified? For details, seeComplex Multi-definition lineAndComplex Polygon. If the sdo_etype value is 1, 2, 1003, or 2003, the identifier determines the translation sequence of the element coordinate queue.

Sdo_starting_offset and sdo_etype tablesAs follows:Figure 4:

V. sdo_ordinates

The construction method of the sdo_ordinates type is: sdo_ordinate_array (x1, Y1, X2, Y2 ,......), Among them, the X1 and Y1 types are both double and Int.

Sdo_ordinates stores the geometric node coordinate sequence of the spatial object. It is separated by commas (,) between X, Y, Z, and different points. The field is of the number type with a length of 1048576. If the ry is two-dimensional, the stored sequence is {y1, X2, Y2, X3, Y3, X4, y4 ......} format. If the ry is a three-dimensional coordinate, for example, the polygon storing the three-dimensional coordinates is {x1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3, X4, y4, Z4, X1, Y1, Z1} format. The data in the coordinate sequence must be legal and not empty. The combination of specific coordinates into ry is understood by sdo_elem_info.

Vi. Example:

6.1,Rectangle:

The specific geometric shapes and coordinates of the rectangle, such:

Use sdo_geometry to define the rectangle and determine the parameter values in the sdo_geometry () constructor. The detailed explanation is as follows:

Sdo_gtype = 2003; 2 in 2003 represents two-dimensional data, and 3 in 2003 represents a polygon. ReferenceFigure 1

Sdo_srid = NULL;

Sdo_point = NULL;

Sdo_elem_info = (1, 1003, 3).; the last 3 in the Property Unit sdo_elem_info (, 3) indicates that the ry is a rectangle. For details, referFigure 4.

--- Because it is a rectangle and is two-dimensional, its construction method is: sdo_point_type (sit-down coordinate, top right coordinate ).

Sdo_ordinates = (,). defines the specific sit-down coordinate sequence and the coordinate sequence of the upper right coordinate.

Example:Insert a rectangle using SQL commands:

Insert into beniy388 values (
1, // values of other attribute Fields
'Uploads', // values of other attribute Fields
MDSYS. sdo_geometry (// value of the geometric field sdo_geometry
2003, -- two-dimensional polygon
Null,
Null,
MDSYS. sdo_elem_info_array (1003, 3), -- a rectangle (is a counter-clockwise direction)
MDSYS. sdo_ordinate_array (,) -- only two points are required.

)
);

 
6.2,Island Polygon:
 
The specific geometric shapes and coordinates of an island polygon, such:
 
 

Use sdo_geometry to define the polygon and determine the parameter values in the sdo_geometry () constructor. The detailed explanation is as follows:

Sdo_gtype = 2003; --- 2 in 2003 represents two-dimensional data, and 3 in 2003 represents a polygon. ReferenceFigure 1

Sdo_srid = NULL;

Sdo_point = NULL;

Sdo_elem_info = (, 1, 1); --- has two sdo_elem_info attribute elements. ReferenceFigure 4

--- Where1003Indicates that the corresponding coordinate sequence is composedRyIt is an external polygon ring (clockwise), and 2003 indicatesRy BIt is the inner polygon ring (counterclockwise ).

--- 19 indicatesRy BThe starting position of the coordinate sequence, that is, the geometric coordinate composition starting from 19.Ry BAnd 1 to 18Ry.

Sdo_ordinates = (10, 10, 10, 14, 6, 10, 14, 10); --- coordinate Series

Example:Insert an island polygon using SQL commands:

Insert into beniy388 values
10, // values of other attribute Fields
'Uploads', // values of other attribute Fields
MDSYS. sdo_geometry (// value of the geometric field sdo_geometry
2003,
Null,
Null,
MDSYS. sdo_elem_info_array (, 1, 1), -- Island Polygon
MDSYS. sdo_ordinate_array)
)
);

6.3,Complex Multi-definition line

Describes a complex multi-definition line composed of a straight line and a curve. In the figure, four points (10, 10) and (10, 14) represent a straight line; 10, 14), (10, 6), and () describe an arc curve:


Use sdo_geometry to define the complex multi-definition line and determine the parameter values in the sdo_geometry () constructor. The detailed explanation is as follows:

Sdo_gtype = 2002; 2 in 2002 represents two-dimensional data, and the second 2 represents one or more line segments. ReferenceFigure 1.

Sdo_srid = NULL;

Sdo_point = NULL;

Sdo_elem_info = (, 2, 1, 3, 2). --- there are three productkey, the last two are the sdo_elem_info attribute elements, and the first one is the expression combination. ReferenceFigure 4.

--- The first triple [, 2], according to 4, can be a description triple, 2 indicates that there are two geometric elements, that is, the last two three tuples describe their respectiveRyAndRy B.

--- The second triplet [, 1] is the sdo_elem_info attribute element triplet, which describesRy. AccordingFigure 4We can see that it is a straight line segment, and the last node of the straight line segment is still the next one.Ry BStart point, that isRyAndRy BThe geometric nodes overlap.

--- The second triple [3, 2, 2] is the sdo_elem_info attribute element, which describesRy B. AccordingFigure 4It is a curve segment.Ry BStart Point andRyEnd nodes overlap.

Sdo_ordinates = (10, 10, 10, 14, 6, 10, 14, 10); --- coordinate Series

Example:Insert a complex multi-definition line using SQL commands:

Insert into beniy388 values (
11, // values of other attribute Fields
'Uploads', // values of other attribute Fields
MDSYS. sdo_geometry (// value of the geometric field sdo_geometry
2002,
Null,
Null,
MDSYS. sdo_elem_info_array (, 2, 1, 2), -- complex multi-definition line
MDSYS. sdo_ordinate_array (10, 10, 10, 14, 6, 10, 14, 10)
)
);

 

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.