I'm reading Oracle's documentation and i can't see the difference between Point cluster
and MultiPoint
element type.
The following example code is from the documentation
INSERT INTO t1 (i, d, g)
VALUES (
16,
'Point cluster',
sdo_geometry (2005, null, null, sdo_elem_info_array (1,1,3),
sdo_ordinate_array (50,5, 55,7, 60,5))
);
INSERT INTO t1 (i, d, g)
VALUES (
17,
'Multipoint',
sdo_geometry (2005, null, null, sdo_elem_info_array (1,1,1, 3,1,1, 5,1,1),
sdo_ordinate_array (65,5, 70,7, 75,5))
);
It seems that:
Point cluster
is one element (of many points -in that example 3 points: 50,5, 55,7, 60,5) as it needs one triplet in sdo_elem_info_array
MultiPoint
is many elements ( and each element is a Point
-in that example 3 points: 65,5, 70,7, 75,5) as it needs three triplets in sdo_elem_info_array
And further down documentation refers to them as the same thing(?):
2.5.8 Several Geometry Types
Example 2-13 creates a table and inserts various geometries,
including multipoints (point clusters), multipolygons, and collections...
What is this mess? What's the difference? The sdo_geometry
requires different sdo_elem_info_array
parameters so there must be a difference between those types?
1 Answer 1
You are creating the same MultiPoint
geometry with different constructor parameters for SDO_ELEM_INFO_ARRAY
. You are defining the GTYPE
of your geometry with the first parameter of the constructor (2005) where the 5 says that your geometry is a MultiPoint!
You can also check the GTYPE of your geometry like this:
SELECT x.g.GET_GTYPE() AS geometry_type FROM t1 x WHERE x.i = 16;
-- returns 5
SELECT x.g.GET_GTYPE() AS geometry_type FROM t1 x WHERE x.i = 17;
-- returns 5
The difference is just in the creation of the SDO_ELEM_INFO_ARRAY
which takes attributes of the type SDO_ELEM_INFO
. Each SDO_ELEM_INFO
is a triple of numbers where the digits mean:
SDO_STARTING_OFFSET
: The index inSDO_ORDINATE_ARRAY
where this (sub-)geometry begins.SDO_ETYPE
: The geometry (element) type of the (sub-)geometry (where 1 means point!)SDO_INTERPRETATION
: The specification of the element type (which relies on theSDO_ETYPE
). For points- 1 means a single point ->
SFA: Point
- n> 1 means a collection of n points ->
SFA:MultiPoint
- 1 means a single point ->
Your first point (id 16) is created using a value of 3 for SDO_INTERPRETATION
which means that your ordinates are interpreted as a collection of points.
The second point (id 17) is created using a value of 1 for SDO_INTERPRETATION
which means that your ordinates are interpreted as single points. This is why the SDO_STARTING_OFFSET
has to specify the start index for each of your points (1, 3, 5).