Oracle Spatial Sdo_geometry Detailed description ____oracle

Source: Internet
Author: User

In ArcGIS, there are several ways to store data from SDE Storage to Oracle: binary long Raw, ESRI's st_geometry, and Oracle spatial sdo_geometry, and so on. <updoogis Original >

The pros and cons of these approaches are not the main direction to explore, and we can get help from ArcGIS Server in ArcGIS. The main point here is to learn about storage based on Oracle spatial, where the field type of geometric column shape is mdsys.sde_geometry type.

The sdo_geometry types defined by Oracle spatial are:
CREATE TYPE Sdo_geometry as OBJECT (
Sdo_gtype number,//front string is field name; Following string is field type
Sdo_srid number,
Sdo_point Sdo_point_type,
Sdo_elem_info Sdo_elem_info_array,
Sdo_ordinates Sdo_ordinate_array);

Where the 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 element is geometry), not how he is organized. As for the type of Sdo_point_type, Sdo_elem_info_array, Sdo_ordinate_array is also the type of Oracle spatial customization and Sdo_geometry is the same.

Now a simple introduction to each parameter in the Sdo_geometry type:

1. Sdo_gtype: Represents the geometry type to be stored, such as the dot line surface. It is expressed by number type;

2, Sdo_srid: Geometry of the space reference coordinate system, the type is also 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: storage of actual coordinates, to X, Y and different points are separated by commas;

The meaning of these field parameters is described in detail below

First, Sdo_gtype

The Sdo_gtype value consists of four digits, and their format is: 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;

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

The following is the two-dimensional geometric type of t=2, Sdo_gtype parameter values, as shown in Figure 1:

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

Second, Sdo_srid

Sdo_srid defines the 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_ In 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 the x,y,z type is double and int can be

The Sdo_point field is defined as the Sdo_point_type type that contains the X, Y, and Z properties. If the geometry type is a point type, the corresponding value for Sdo_elem_info and sdo_ordinates is null,sdo_point not null. In other cases, Sdo_point is set to null by spatial. If this layer has only a point object, then it is recommended that you save it in the Sdo_point attribute. 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 value

Four, 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 focus and difficulty of understanding and mastering Sdo_geometry, Sdo_elem_info defines how to understand the coordinate string properties in Sdo_ordinates.

Sdo_elem_info each three digits into a 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's what these three numbers mean:

4.1. Sdo_starting_offset: Declares the coordinate number of the first coordinate that makes up the current geometry fragment in the sdo_ordinates array. The coordinate sequence number starts at 1 rather than starting at 0. The sdo_ordinates here 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" Start geometry fragments, Coordinate sequence number sdo_starting_offset=3. (Specific reference to the following examples to understand)

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

The Sdo_etype value = 1, 2, 1003, or 2003, indicating that geometry is a simple geometric type. You can all use the Sdo_elem_info property unit "that is three comma-separated numbers" to understand the coordinate sequences in Sdo_ordinate_array.

Special Note: Sdo_etype value = 1003, if the geometry type is face, then the outer polygon ring (in counter-clockwise order)

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

The Sdo_etype value = 4,1005 or 2005, which indicates that geometry is a composite element, and that the first three digit group is not a Sdo_elem_info property unit, but rather to describe the information of the composite element. You can see examples of complex polygonal lines 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, the number of combinations is identified, referring to examples of complex polygonal lines and complex polygons. If the Sdo_etype value = 1, 2, 1003, or 2003, the identity determines the translation order of the element coordinate queues.

The Sdo_starting_offset and Sdo_etype tables are shown in Figure 4:

Five, Sdo_ordinates

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

Sdo_ordinates stores the geometric node coordinate sequence of a space object, separating X, Y, z, and different points by commas, which is the property of the numeric number type of length =1048576. If the geometry is two-dimensional, the stored sequence is {Y1, X2, Y2, X3, Y3, X4, Y4 ...} format; geometry is three-dimensional coordinates, such as the three-dimensional coordinates of the polygon it stores the 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 both valid and not empty. The combination of the concrete coordinates into the geometry of the combined sdo_elem_info to understand.

Vi. Reference Examples:

6.1. Rectangle:

The concrete geometry and coordinates of the rectangle, as shown in the following illustration:

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 unit Sdo_elem_info (1,1003,3) indicates that the geometry is rectangular, referring to Figure 4.

---because it is rectangular and two-dimensional, its construction method is: sdo_point_type (sit down coordinates, upper right coordinates).

Sdo_ordinates = (1, 1, 5,7). The specific coordinates of the seated and upper right coordinates are defined.

Example: Inserts a rectangle with the SQL command:

INSERT into beniy388 VALUES (
1,//other value of the property field
' Updoogis ',//value of other property fields
Mdsys. Sdo_geometry (///Sdo_geometry value of Geometry field)
2003,--two-dimensional polygon
Null
Null
Mdsys. Sdo_elem_info_array (1,1003,3),--a rectangle (1003 is counterclockwise direction)
Mdsys. Sdo_ordinate_array (1, 1, 5,7)--it only takes two.

)
);

       6.2, have island polygon:
       The concrete geometry and coordinates of the island polygon are shown below:
       

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 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

---1003 shows that the geometric a of the corresponding coordinate sequence is the outer polygon ring (clockwise), and 2003 indicates that the geometric B of the corresponding coordinate sequence is the inner polygon ring (counterclockwise).

---19 represents the position at which the geometric b-coordinate sequence begins, that is, the geometric coordinates starting at 19 are composed of geometric B, and 1 to 18 comprise geometry a.

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

Example: Inserts a polygon with an island in SQL command:

INSERT into beniy388 VALUES
10,//other value of the property field
' Updoogis ',//value of other property fields
Mdsys. Sdo_geometry (///Sdo_geometry value of Geometry field)
2003,
Null
Null
Mdsys. Sdo_elem_info_array (1,1003,1, 19,2003,1),--there are island polygons
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-semantic line

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.