This project has moved and is read-only. For the latest updates, please go here.

oracle sdo_geometry UDT mapping

Topics: SharpMap v0.9 / v1.x
Apr 3, 2011 at 11:47 AM
Edited Apr 3, 2011 at 11:48 AM


I'm testing Oracle Data Provider. I get the following exception when i call the GetFeature(id):

Custom type mapping for 'dataSource='bla bla bla' schemaName='MDSYS' typeName='SDO_GEOMETRY'' is not specified or is invalid.

since the code tries to ask for the foolowing query:

"select g.* , g.Geom.Get_WKB() As sharpmap_tempgeometry from LAKE g WHERE LAKE_PK='2'"

FeatureDataSet ds = new FeatureDataSet();

The problem is that the data adapter does not know the .NET type SDO_GEOMETRY is mapped to (because the g.* contains (at least) one geometry field).

Any hint?

Thanks so much!

Apr 4, 2011 at 10:10 AM

Please have a look at:

Hth FObermaier

Apr 4, 2011 at 10:24 AM
Edited Apr 4, 2011 at 10:25 AM

Hi FObermaier,

my problem looks different (I use oracle 11). The problem is that the select statement built by GetFeature (and also other) method contains 2 geometry columns: the first is the one inside the g.*, of type SDO_GEOMETRY, the second is the WKB one, of type byte[].

Now, the adapter.Fill(ds); call throws an exception, since there is no .Net datatype for the column corresponding to the SDO_GEOMETRY.

Hope it is clear now!


Apr 4, 2011 at 10:46 AM

Have you tried updating the base provider? The one in the sharpmap repository seems to be quite old.

Hth FObermaier

Apr 4, 2011 at 10:49 AM

The next step I'd take is to replace the g.* of the select by an enumeration of the columns actually wanted. you can use a datareader and its GetSchemaTable() function to get that information

I do not have an Oracle database at hand, so I cannot help you any further than this.

Hth FObermaier

Apr 4, 2011 at 11:25 AM

For what I know, the Get_WKB() function is used just because of the missing .Net mapping for SDO_GEOMETRY. question is also: am I the first one encountering this problem?

Apr 12, 2011 at 4:36 AM

dear ibazar83, i have encountered this question too, but i haven't find a way to solve it ,had you solve this problem,  if you had solved it can you give me a message ,thank you

Apr 12, 2011 at 6:26 AM
Edited Apr 12, 2011 at 6:27 AM

The first solution is to manually remove the g.* from every query in the code.

The second solution is to include the NetSdoGeometry project in your solution. That project instructs .Net to use the proper object mapping for the oracle sdo_geometry UDT. At this point, one could also remove the g.Geom.Get_WKB() from the query.

Apr 12, 2011 at 8:53 AM

ibazar, would you mind creating a patchfile and submit that, so we can update the provider?

thanks FObermaier