ORA-13367 - Spatial

Does anyone what error ORA-13367 is, I can't seem to find it in any of the documentation. I got the error when I was using function SDO_GEOM.VALIDATE_GEOMETRY on 9.2 on Windows 2000.
Thanks in advance
Jackie Cooper 

From ORA-Documentation
ORA-13367 Wrong orientation for interior/exterior rings
Cause: In a spatial geometry, the exterior and/or interior rings are not oriented correctly.
Action: The exterior rings should be oriented counter clock-wise and interior rings should be oriented clock wise.


extracting first and last vertex from a Geometry field

Is there any PL/SQL routine to coordinates of the first vertex and coordinates of last vertex from Geometry field? Do we have any pre-defined methods available in JAVA API for this.
Thanks and Regards
I got a solution for getting the first and last vertex from a Geometry field using
Java API.Here I’m using getFirstPoint() and getLastPoint() methods JGeometry.
Thanks and Regards
I have offered some pure pl/sql packages to others that help in programming
against Oracle Spatial in Triggers etc. If you are interested email me
"spatialdbadvisor at netspace dot net dot au"
I haven't had much feedback on their use but I certainly find them useful.

Convert 3D wkt to SDO_GEOMETRY

I have a 3D WKT point and I try to insert it to an SDO_GEOMETRY column.
When executing the following:
Select SDO_GEOMETRY('POINT(2 2)') from dual;
I get the correct result, but when executing the 3D point like
the following:
Select SDO_GEOMETRY('POINT(2 2 3)') from dual;
I get an error.
How can I convert 3D wkt to an SDO_GEOMETRY?
In your posts:
1. try to mention DB version
2. try to include the type of error and the error message
I use oracle 11g.
When executing the following:
select SDO_UTIL.FROM_WKTGEOMETRY('POINT(2 2 2)') from dual;
I get the error:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.RuntimeException: -2
ORA-06512: at "MDSYS.SDO_UTIL", line 177
Is there a way to convert 3D point in WKT to SDO_GEOMETRY?
Hi dyahav,
I believe the answer is "No". Oracle Spatial implements OGC Simple Features per ISO 13249-3 which I think equates to OGC Simple Feature OGC 05-126 version 1.10.
This specification only includes 2D geometries. I think it would be useful if the documentation just said that. The newer OGC 06-103r3 version 1.2.0 specification does support Z and M values on geometries.
So you either need to write your own WKT parser or submit an enhancement request to Oracle to support WKT version 1.2.0.
Also, your WKT example does not specify what exactly your third dimension is. It could be a Z or an M (measure). Extended WKT specifies this by appending this information to the type name, eg.
POINT Z('2 2 2')
POINT M('2 2 0.25')
POINT ZM('2 2 2 0.25')
POINT MZ('2 2 0.25 2')
Hope that helps!
Thanks for the detailed answer

Linestring with measures and SDO_GEOMETRY

Does SDO_GEOMETRY WKT constructor support Linestring with measures (linestring m)? I run the following statement and got ORA-29352 error Malformed WKT: select sdo_geometry('linestring m(10.05 10.28 5.84, 20.95 31.98 9.01, 21.98 29.80 12.84 )') from dual; Thanks,Hussein
Hi Hussein, Oracle Spatial fully support LRS measures on geometries.  However, Oracle Spatial's implementation of WKT does not - it only supports version 1.1.0 of the OGC WKT Simple Features Access specification.  So you need some other way to input your LRS measures into Oracle. You can always use the native constructors. SELECT MDSYS.SDO_GEOMETRY(3302,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(10.05,10.28,5.84,20.95,31.98,9.01, 21.98,29.80,12.84)) FROM dual; Or if you are really in a bind to read and write modern forms of WKT you could try hooking in to JTS as shown by Simon Greener or try my own PLSQL based solution. Cheers, Paul
Thank you Paul. I will try the native constructors.

get the coordinates from SDO_POINT in VC++ 6.0

Hi All,
How can I get the coordinates from SDO_POINT in VC++ 6.0 ?
I do the following :
OObject bGeometry = dbBox.GetField("GEOMETRY");
OValue Ordinates = bGeometry.GetAttrValue("SDO_POINT");
How can I access the values in the Ordinates object ?
Are you using Oracle Objects for OLE (OO4O)? Go to http://otn.oracle.com/tech/windows/ole/content.html and check it out. I have found it to be the best way of accessing the sdo_ordinates array.
Hope it helps.

Something wrong with oracle.sdoapi.sref?

I stored my coordinates with sid = 82202 in the tables.
I want my coordinates in the same coordinate system but in Lat/Long.
The sid for this is 8288.
So I have tested oracle.sdoapi.sref using this code section:
//Transformation i Oracle RT90 -> RT90 Lat/Long
SRManager srManager = OraSpatialManager.getSpatialReferenceManager();
// Create spatial references from ID 82202 = RT90 X/Y
int id1 = 82202;
SpatialReference sr1 = srManager.retrieve(id1);
// Create spatial references from ID 8288 = RT90 Lat/long
int id2 = 8288;
SpatialReference sr2 = srManager.retrieve(id2);
// Create transformation sr1 -> sr2
Transform xform = srManager.createTransform(sr1, sr2);
// Transform a geometry object from sr1 to sr2
Geometry geom2 = xform.transform(geom1);
The result is like this:
Coordinates stored in Oracle
Same point calculated using oracle.sdoapi.sref to
This point should have been like this
If I take the same point calculated using oracle.sdoapi.sref
and I calculate it my self to XY I will get
What is wrong?
Doing Coordinate change from XY to Lat/Long is nothing more then mathematics.
It is not any coordinate system change and it should not be any error at all.
Here it is like 1 meter error.
Please give me some help! 
Coordinate transformations are not supported in SDOAPI.
Use the Oracle Spatial functionality instead.
Sorry but
I don't understand the answer.
I'am reading "Java Library User's Guide"
"Release 8.1.7 or later."
Page 1-21 and 1-22 "Using Spatial Reference Systems".
Can you please tell me which part of SDOAPI is in use?
SDOAPI is only for converting between the database structure and a Java object, i.e. SDO_GEOMETRY <--> oracle.sdoapi.Geometry
Transforming between coordinate systems is not fully implemented or supported.
The Transform interface may be used to implement your own coordinate transformation functions. SDOAPI does not provide supported functionality for Coordinate Transformations. That is it is incomplete and as you indicate possibly incorrect.
Did the server side (SQL) transform functions work correctly?
Yes, nearly.
RT90 X-coordinate precision in millimetres.
RT90 Y-coordinate precision in centimetres.
I would have seen both with accuracy in millimetres.
If we put in and out coordiantes a couple of times we will get lost.
we met the same problems with the SDOAPI. The transform method doesn't work correctly.
Do you know when this problem will be resolved ?
more precisely our problem is this one :
we try to make a conversion from a latitude/longitude coordinate system (Netherlands in our example) to another latitude/longitude (WGS84) coordinate system. Coordinates in decimal degrees of the geometry object are transformed but the results in decimal degrees seems to have been converted as if they were radians:
coordinates before transformation:
coordinates after transformation:
Those coordinates should be quite the same.
code :
SpatialReference sourceSR = m_srManager.retrieve(8273);
SpatialReference targetSR = m_srManager.retrieve(8307);
m_geomTransformer = m_srManager.createTransform(sourceSR,targetSR);
GeometryFactory geoFactory = OraSpatialManager.getGeometryFactory();
Point point1 = geoFactory.createPoint (42.327,3.312);
Point pointResult = m_geomTransformer.transform ( point1 );
pointResult is wrong !
Thank you for your help
Bertrand F.
Use ths coordinate conversion functionality of Oracle Spatial, i.e. the MDSYS.SDO_CS package, instead of the sample implementation in sdoapi.
As Jayant mentioned, the java functionality for coordinate systems transformation is not supported. Please
use the server for coordinate systems transformations. 
Our problem is to convert many geometries on the client side.
So, the solution with Oracle spatial is not good for us because it will generate many network communications.
We expect Oracle will correct the SDOAPI about this problem.
Is it planned ? if Yes, when it's planned ?
Thank you for your help.
Pierre J & Bertrand F.
Regarding adding coordiante transform support in SDOAPI see the note on OTN:
Note: This will be the last version of this Spatial Java API released on OTN. A new Java API is planned for the next major Oracle database release, and it will be shipped with Oracle Spatial. This new API will be available only with Oracle Spatial and will not be available through the OTN.
Regarding your issue about converting multiple geometries and network round trips.
If the geometries came from the server in the first place then they could have been transformed there before fetching to the client.
Thank you for your answer.