开发者

Usage of SDO_POINT from Oracle

开发者 https://www.devze.com 2023-04-01 14:11 出处:网络
I am working with Oracle Spatials and I have the following query: The SDO_GEOMETRY if made of five constituent data:

I am working with Oracle Spatials and I have the following query:

The SDO_GEOMETRY if made of five constituent data:

CREATE TYPE sdo_geometry AS OBJECT ( SDO_GTYPE NUMBER, SDO_SRID NUMBER, SDO_POINT SDO_POINT_TYPE, SDO_ELEM_INFO SDO_ELEM_INFO_ARRAY, SDO_ORDINATES SDO_ORDINATE_ARRAY);

Once I query the database to get the resultSet - how do I get to the costituent data from the above object.

I am basically interested in 开发者_开发知识库getting the x and y coordinates from the SDO_POINT so as to be able to update the values in another POJO Class.

I did go through the JGeometry option from: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14373/oracle/spatial/geometry/JGeometry.html

but I am probably missing something and I am not able to use it.

Any help would be much appreciated.


The JGeometry class is contained in sdoapi.jar. In my install, I found it in /apps/oracle/product/102040/md/lib/. The 102040 part may differ for you.

Get the SDO_Geometry out of the result set, and then load it, like so:

STRUCT struct = (STRUCT) resultSet.getObject(resultSetIndex);
JGeometry jGeo = JGeometry.load(struct);

You can then get the information you need right out of that object. Depending on the contents, you may be able to use getPoint() or you may need to use getType(), getElemInfo(), getOrdinatesArray(), etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消