"Reproduced" in Oracle spatial sdo_geometry detailed description

Source: Internet
Author: User

Reproduced for individual study reference, please visit the original source: http://www.cnblogs.com/upDOoGIS/archive/2009/05/20/1469871.html

related micro-blog: Oracle Create sdo_geometry table

There are several ways to store data from SDE storage in ArcGIS to Oracle, including binary long Raw, Esri St_geometry, and sdo_geometry based on Oracle spatial, among others.

The pros and cons of each of these approaches are not the main areas of discussion, which we can get help with from ArcGIS servers in ArcGIS. This is mainly about learning about the storage method based on Oracle spatial, which is a type of mdsys.sde_geometry for the field type of Geometry column shape.

The sdo_geometry types defined by the Oracle spatial are:
CREATE TYPE Sdo_geometry as OBJECT (
Sdo_gtype number,//The preceding string is the field name, and the following 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);

Where Sdo_geometry as Object, identifies the type as an object type. At first we can think of it as the Geometry object in Arcobjects (the object in the Shape field of the original feature is geometry), rather than understanding how he was organized. As for the type of Sdo_point_type, Sdo_elem_info_array, Sdo_ordinate_array is also the Oracle spatial custom type and sdo_geometry are the same.

Now a simple introduction to the various parameters in the Sdo_geometry type:

1. Sdo_gtype: Represents the type of geometry to be stored, such as a point line face. It is expressed by the number type;

2, Sdo_srid: Geometry of the spatial reference coordinate system, the type is number;

3, Sdo_point: If the Geometry type point type, is the storage point coordinates, otherwise is empty. Oracle custom Sdo_point_type type;

4, Sdo_elem_info: Define how to understand the sdo_ordinates in the coordinate string;

5, Sdo_ordinates: Store the actual coordinates, with X, Y and different points are separated by commas;

The meanings of these field parameters are described in more detail below

First, Sdo_gtype

The Sdo_gtype value is made up of four digits, in the format: DLTT.

where d represents the dimension of the geometry. such as two-dimensional, three-dimensional corresponding d=2 and d=3;

L defines the LRS. General l=0;

The TT defines the type of the geographic object. Now used from 00 to 07, as TT=01 is represented as a single point;

Here is the t=2 two-dimensional geometry type, sdo_gtype parameter value specific, as shown in Figure 1:

For a given layer, all geographic objects must be of the same dimension, and two-dimensional and three-dimensional data cannot be placed in a single layer.

Second, Sdo_srid

Sdo_srid defines a spatial coordinate reference system. If Sdo_srid is null, the coordinate system is not specified, and if Sdo_srid is not NULL, its value must have a corresponding value in the SRID column in the Mdsys.cs_srs table, and its value must be inserted into the USER_SDO_GEOM_ The metadata view. Mdsys.cs_srs Table Reference Figure 3

Third, Sdo_point

The Sdo_point type is constructed by: Sdo_point_type (x, Y, z), where x, Y, z types are double and int are available

The

              sdo_point field is defined as a sdo_ with the X, Y, Z Properties The Point_type type. If the geometry type is a point type, the values corresponding to Sdo_elem_info and sdo_ordinates are null,sdo_point  not null. In other cases, Sdo_point is set to NULL if it is ignored by spatial. If this layer has only a point object, then it is recommended that you save it in the Sdo_point property. The Sdo_point_type type is defined as follows:

CREATE TYPE Sdo_point_type as OBJECT (
X number,//x coordinate value
Y number,//y coordinate value
Z number); z-coordinate values

Iv. Sdo_elem_info

The Sdo_elem_info type is constructed by: Sdo_elem_info_array (A,B.C), where A,B.C is the number type.

Sdo_elem_info is the key and difficult point to understand and master Sdo_geometry, Sdo_elem_info defines how to understand the coordinate string properties in Sdo_ordinates.

Sdo_elem_info each of the three numbers into a single sdo_elem_info attribute unit (which can be understood in conjunction with the following example).

Each Sdo_elem_info property unit consists of: Sdo_starting_offset, Sdo_etype, and Sdo_interpretation. Here are the specific meanings of these three numbers:

4.1. Sdo_starting_offset: Declares the number of coordinates in the Sdo_ordinates array that comprise the first coordinate of the current geometry fragment. The coordinate sequence number starts from 1 and not from 0. Here the sdo_ordinates is the coordinate sequence in the sdo_geometry, the coordinate sequence is a comma-separated number, the specific calculation such as: Sdo_ordinate_array (1,4,6,7,8,9) if the "6" to start a geometric fragment, The coordinate ordinal sdo_starting_offset=3. (Refer to the following example to understand)

4.2. Sdo_etype: Declares the type of the element. Can be combined with sdo_starting_offset and Sdo_etype table to understand.

The Sdo_etype value = 1, 2, 1003, or 2003, which indicates that the geometry is a simple geometry type. You can fully understand the sequence of coordinates in Sdo_ordinate_array by sdo_elem_info the property unit "three comma-separated number".

Special Note: Sdo_etype value = 1003, if the geometry type is a polygon, it is represented as an outer polygon ring (in counter-clockwise order)

Sdo_etype value = 2003, if the geometry type is a polygon, it is represented as an inner polygon ring (in clockwise order)

The Sdo_etype value = 4,1005 or 2005, which indicates that the geometry is a composite element, often the first three-digit group is not a Sdo_elem_info property unit, but rather to illustrate the information of the combined element. See examples of complex polylines and complex polygons below.

4.3, sdo_interpretation: There are two possible meanings, depending on whether the sdo_etype is a combination of elements. If the Sdo_etype value = 4,1005 or 2005, identifies how many combinations are in the section, specifically referring to complex multiline and complex polygon examples. If the Sdo_etype value = 1, 2, 1003, or 2003, the identity determines the order of translation for the element coordinate queue.

The Sdo_starting_offset and Sdo_etype tables are shown in Figure 4:

Wu, Sdo_ordinates

The sdo_ordinates type is constructed by: Sdo_ordinate_array (X1,y1,x2,y2,......), where the x1,y1 type is either double or int.

Sdo_ordinates stores the geometric node coordinate sequence of the spatial object, separating the x, Y, z, and the different points with commas, the field nature: the number type of the length =1048576. If the geometry is a two-dimensional case, the stored sequence is {Y1, X2, Y2, X3, Y3, X4, Y4 ...} Format, geometry is three-dimensional coordinates, such as three-dimensional coordinates of the polygon its storage sequence for {X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3, X4, Y4, Z4, X1, Y1, Z1} format. The data in the coordinate sequence must be valid and not empty. The combination of specific coordinates into the geometry of the combined sdo_elem_info to understand.

Vi. Examples of reference:

6.1. Rectangle :

The specific geometry and coordinates of the rectangle, such as:

Define the rectangle with Sdo_geometry, and how to determine the values of each parameter in the Sdo_geometry () construction method. Detailed explanations are as follows:

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

Sdo_srid = NULL;

Sdo_point = NULL;

Sdo_elem_info = (1, 1003, 3).; The last 3 in the property cell Sdo_elem_info (1,1003,3) indicates that the geometry is rectangular, refer to Figure 4 .

---because it is rectangular and two-dimensional, it is constructed by: sdo_point_type (sit down coordinates, upper right coordinate).

Sdo_ordinates = (1, 1, 5,7). Defines the coordinate sequence of the specific sit-down and top-right coordinates.

Example: Inserting a rectangle with a SQL command:

INSERT into beniy388 VALUES (
1,//value of other property fields
The value of ' Updoogis ',//other property fields
Mdsys. Sdo_geometry (//Value of Geometry field sdo_geometry
2003,--two-dimensional polygon
Null
Null
Mdsys. Sdo_elem_info_array (1,1003,3),--a rectangle (1003 counterclockwise)
Mdsys. Sdo_ordinate_array (1, 1, 5,7)--only two points required

)
);

       6.2, There are island polygons :
       The specific geometry and coordinates of an island polygon, such as:

Define the polygon with sdo_geometry, and how to determine the values of each parameter in the Sdo_geometry () construction method. Detailed explanations are as follows:

Sdo_gtype = 2003; the 2 in---2003 represents two-dimensional data, and 3 in 2003 represents a polygon. Specific reference Figure 1

Sdo_srid = NULL;

Sdo_point = NULL;

Sdo_elem_info = (1,1003,1, 19,2003,1);---has two triples sdo_elem_info attribute elements. Specific reference Figure 4

---wherein 1003 indicates that the corresponding coordinate sequence consists of a geometry A is an outer polygon ring (clockwise), and 2003 indicates that the corresponding coordinate sequence consists of a geometry B as an inner polygon ring (counterclockwise).

---19 represents the starting position of the geometry B-coordinate sequence, that is, the geometric coordinates starting at 19 are composed of Geometry B, and 1 to 18 make up geometry A.

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

Example: Inserting a polygon with an island with an SQL command:

INSERT into beniy388 VALUES
10,//value of other property fields
The value of ' Updoogis ',//other property fields
Mdsys. Sdo_geometry (//Value of Geometry field sdo_geometry
2003,
Null
Null
Mdsys. Sdo_elem_info_array (1,1003,1, 19,2003,1),--Island polygon
Mdsys. Sdo_ordinate_array (2,4, 4, 3, 10, 3, 13, 5, 13, 9, 11, 13, 5, 13, 2, 11, 2,4,7,5, 7, 10, 10, 10, 10, 5, 7,5)
)
);

6.3, complex multi-righteousness line        

Describes a complex multiline that consists of a line and a curve. 4 points appear in the figure, (10,10) and (10,14) points are lines, 10,14), (10,6), and (14,10) describe the arc curve:


Define the complex multiline with Sdo_geometry, and how to determine the values of each parameter in the Sdo_geometry () construction method. Detailed explanations are as follows:

Sdo_gtype = 2 in 2002;2002 represents two-dimensional data, and the second 2 represents one or more straight segments. Refer to Figure 1 for details.

Sdo_srid = NULL;

Sdo_point = NULL;

Sdo_elem_info = (1,4,2, 1,2,1, 3,2,2). ---has three triples, the last of which is the Sdo_elem_info attribute element ternary, and the previous one is the expression combination. Refer to Figure 4for details.

---The first ternary "1,4,2", according to 4 can be obtained is a description of ternary group, 2 means that there are two geometric elements, that is, the latter two triples describe their respective geometry A and Geometry B.

---the second ternary "1,2,1", which is the Sdo_elem_info attribute element ternary, which describes the geometry A. As shown in Figure 4 , it is a straight line segment, and the last node of the line segment is the starting point of the next Geometry B, where geometry A and geometry B have geometric nodes coincident.

---the second ternary "3,2,2", which is the Sdo_elem_info attribute element ternary, which describes geometry B. As shown in Figure 4 , it is a curved segment that coincides with the start point of the Geometry B and the end node of the geometry A.

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

Example: Inserting a complex multiline line with a SQL command:

INSERT into beniy388 VALUES (
11,//value of other property fields
The value of ' Updoogis ',//other property fields
Mdsys. Sdo_geometry (//Value of Geometry field sdo_geometry
2002,
Null
Null
Mdsys. Sdo_elem_info_array (1,4,2, 1,2,1, 3,2,2),--complex multiline
Mdsys. Sdo_ordinate_array (10,10, 10, 14, 6, 10, 14,10)
)
);

"Reproduced" in Oracle spatial sdo_geometry detailed description

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.