Field sdo_geometry____oracle about Oracle Spatial

Source: Internet
Author: User

Reproduced from: http://www.cnblogs.com/lanzi/archive/2010/12/27/1917659.html

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.

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 meanings of these field parameters are described in detail below 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 define 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:

Sdo_gtype

Geometry type

Related description

2000

Unknown geographic type

Spatial will ignore this type of geographical object

2001

Single Point type

A geographical object contains an ordinary point

2002

Single-line polyline and curve types

A geographic object contains a line or fragment segments

2003

Polygon Type

A geographical object contains an ordinary polygon, but does not contain an empty island.

2004

Collection collection type

Geography contains collections of different types of elements

2005

Multi-point Multipoint type

A Geographic object contains a collection of multiple points

2006

Multi-line Mutlipolyline and multi-curve types

A geographic object has one or more lines or a set of curves

2007

Multi-Polygon Mutlipolygon type

A geographical object contains an island (Do) of polygons and N polygons

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 2

Mdsys.cs_srs table

Column Name

Type

Column Name Description

Cs_name

VARCHAR2 (68)

Coordinate system name

SRID

Number (38)

Space reference ID, a unique value. 1-999999 spatial reference for spatial use, 1000000 later for user customization

Auth_srid

Number (38)

Optional Srid, is a foreign key. Srid of another coordinate system

Auth_name

VARCHAR2 (256)

Wktext

VARCHAR2 (2046)

Cs_bounds

Mdsys. Sdo_geometry

 


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 : Declares the type of an 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 element. 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 3:

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 (lower left coordinate, upper right coordinate).

Sdo_ordinates = (1, 1, 5,7). Defines the exact left and right coordinates of the coordinate sequence.

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

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.