Using .NET, I have a sqlite file that I have to import to oracle. The geometry needs to be converted from sqlite (spatialite) geometry column to a sdo_geometry column in oracle:

// Loop through all records in sqlite file
foreach (DataRow row in dsSqLite.Tables["Default"].Rows)
  // Get geometry field from sqlite and get it ready for oracle format
  NetSdoGeometry.sdogeometry geom = row["GEOMETRY"];  // ERROR HERE

When I execute the above, I get an error "Unable to cast object of type 'System.Byte[]' to type 'NetSdoGeometry.sdogeometry'. Also I do not see where to specify the SRID. Does anyone know the correct way to convert the geometry column from spatialite to oracle sdo_geometry?

References: NetSdoGeometry library: https://github.com/mapspiral/NetSdoGeometry


From what I see, NetSdoGeometry works only by READING geometries from Oracle into some .net object. I don't see a place where it does the reverse.

Maybe a much simpler solution is to use gdal (ogr2ogr) do copy the content from sqlite into Oracle. See http://www.gdal.org/drv_sqlite.html for details about that driver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.