Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 2.2.M0
-
Fix Version/s: 2.7-M0
-
Component/s: jdbc-oracle plugin
-
Labels:None
Description
Older Oracle version uses different GTYPE values from recent ones.
If you happen to read an old table with the OracleDataStore you may get
a division by zero error because the GTYPE of a SDO geometry may be equal to,
for example, 3 instead of 2003.
So, when execution reaches line 2079 of
org.geotools.data.oracle.sdo.SDO.java
both D and L are equal to 0 so LEN is equal to 0,
so ordinates.length % LEN gives a division by zero error.
An improvement would be to support this old coding or, since very few people
will encounter this problem, at least report it correctly.
Relevant docs from Oracle says this:
> ---------------------------------------------------------------------------
> Note:
> The 1-digit SDO_GTYPE values from before release 8.1.6 value are still
> supported. If a 1-digit value is used, however, Oracle Spatial determines
> the number of dimensions from the DIMINFO column of the metadata views,
> described in Section 2.6.3.
> Also, if 1-digit SDO_GTYPE values are converted to 4-digit values, any
> SDO_ETYPE values that end in 3 or 5 in the SDO_ELEM_INFO array (described in
> Section 2.2.4) must also be converted.
> ---------------------------------------------------------------------------
>
> and:
>
> ---------------------------------------------------------------------------
> Note:
> The use of 3 as an SDO_ETYPE value for polygon ring elements in a single
> geometry is discouraged. You should specify 3 only if you do not know if the
> simple polygon is exterior or interior, and you should then upgrade the
> table or layer to the current format using the SDO_MIGRATE.TO_CURRENT
> <sdo_objmigr.htm> procedure, described in Chapter 17 <sdo_objmigr.htm>.
> You cannot mix 1-digit and 4-digit SDO_ETYPE values in a single geometry. If
> you use 4-digit SDO_ETYPE values, you must use 4-digit SDO_GTYPE values.
> ---------------------------------------------------------------------------
Converting a table created with an old version (with "strange" GTYPEs)
is just a matter of using the
SDO_MIGRATE.TO_CURRENT('table_name')
function.
A good little article about Oracle SDO can be found here:
http://www.oreillynet.com/pub/a/network/2003/11/10/oracle_spatial.html?page=1
btw the first number of a GTYPE indicates the Z Dimension (2003 == 2D, 3003 indicates a 3rd dimension).
Marc