I have a table of GIS segments in an Oracle Spatial database. I'm using C# and ODP to connect to the database. For a given measure from the start of a segment, I want to find the GPS coordinates for that point. I'm running the following query: select g.geom.sdo_ordinates ord_array from
*(select sdo_lrs.locate_pt(shape,0.02,0) as geom from test_schema.test_table* where route='ABC' and segmentnum='101.1') g
where shape is of type SDO_GEOMETRY. I'm getting the following error: ORA-13331: invalid LRS segment
Is there a problem with how I'm passing shape to locate_pt()? The Oracle Spatial documentation says the argument should be SDO_geometry, so that seems ok.
Edited by: 964844 on Oct 11, 2012 2:10 PM
Have you tried to use SDO_LRS.CONVERT_TO_LRS_GEOM fist?
An exception is raised if geom_segment has an invalid geometry type or dimensionality, or if the location is out of range.
Have you checked your shape? Can you show your geometry here?
Hmm, I tried using SDO_LRS.CONVERT_TO_LRS_GEOM(shape) instead of shape, and I got an InvalidOperationException: schemaName='MDSYS' typeName='SDO_GEOMETRY' is not specified or is invalid.
I also tried to check the shape using: select shape from test_schema.test_table where route='ABC'
But that gave me the same error. Is there a different way to check the shape?
Unsure, about the given the InvalidOperationException.
Are you using SQLplus or any SQL tool, or you using this SQL statement through some development component/language?
Maybe there is something wrong with your system.
I'm using C# with ODP.NET.
Here is the current version of the code that is failing:
var param = new OracleParameter("geom", OracleDbType.Object);
param.UdtTypeName = "MDSYS.SDO_GEOMETRY";
param.Direction = ParameterDirection.Input;
OracleCommand oCmd = new OracleCommand();
oCmd.Connection = this.oConn;
oCmd.CommandText = queryStr;
oCmd.CommandType = CommandType.Text;
OracleDataAdapter da = new OracleDataAdapter(oCmd);
DataTable dt = new DataTable();
The exception is generated by the da.Fill(dt) line.