See http://docs.oracle.com/cd/B28359_01/appdev.111/b28400/sdo_objrelschema.htm for more information.
The Oracle sdo_geometry is made up of multiple parts:
• GType: 2003 for areas, 2002 for lines, 2001 for points. Other values are possible, but are rarely seen in HPD. Some HPD functions will return sounding clusters as a 3D set of point locations, gtype 3005.
• SRID: In HPD, the SRID should always be the value p_schema_constants.default_source_geom_srid.
• SDO_POINT: In HPD, the SDO_POINT parameter is always NULL.
• Element information: Each triplet of values has the following meaning:
• 1st value denotes the position of the start coordinate of a ring in the ordinate array. This is always one for the first triplet.
• 2nd value denotes the type of the triplet. Possible values are 1003 (outer ring), 2003 (inner ring), 2 (line), 1 (point)
• 3rd value denotes how the vertices in the polygon are connected.
• 1 = vertices are connected as straight lines using point-to-point line. This is the typical value used.
• 3 = vertices define a 2 point rectangle.
• Ordinates Contains coordinates of vertices that make up a ring. Except for some PCE functions, all geometries are in LLDG in the database datum which by default is WGS84. These are X,Y pairs so the longitude comes before latitude.
Constraint: Outer rings must be listed before inner rings (islands/holes). Outer rings are always counter-clockwise, while inner rings are always clockwise.
Point geometries:
• Gtype is 2001
• Element information is 1,1,1
• Ordinates are the single X,Y pair
Example
sdo_geometry(2001, p_schema_constants.default_source_geom_srid, NULL, |
sdo_elem_info_array(1,1,1), |
sdo_ordinate_array(1,1)) |
Line geometries:
• Gtype is 2002
• Element information is 1,2,1
• Ordinates are multiple X,Y pairs
Example
sdo_geometry(2002, p_schema_constants.default_source_geom_srid, NULL, |
sdo_elem_info_array(1,2,1), |
sdo_ordinate_array(1,1, 2,2, 3,3)) |
Area geometries with no inner rings:
• Gtype is 2003
• Element information is 1,1003,1 or 1,1003,3
• Ordinates are multiple X,Y pairs. The last pair must be the same as the first pair, to close the area.
Example
sdo_geometry(2003, p_schema_constants.default_source_geom_srid, NULL, |
sdo_elem_info_array(1,1003,1), |
sdo_ordinate_array(170,1, 180,1, 180,10, 170,10, 170,1)) |
Area geometries with inner rings:
• Gtype is 2003
• Element information is 1,1003,1 for the outer ring, and then X,2003,1 for the inner rings where X is the index into the ordinate array.
• Ordinates are multiple X,Y pairs. Each ring's set of ordinates must be the same as the ring's first set of ordinates, to close the ring.
Example
sdo_geometry(2003, p_schema_constants.default_source_geom_srid, NULL, |
sdo_elem_info_array(1,1003,1, 19,2003,1), |
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)) |