Hi all,
I encountered a problem while trying to import Oracle Spatial's compound polygons (that are those which contains both straight and arc segments - sdo_gtype=2003, elem_type=1005). I am using VBA to connect and import via gdi keyins:
myMSApp.CadInputQueue.SendKeyin "gdi open name=iskn user=" & ISKN_USER & " password=" & ISKN_PASSWD & " server=" & ISKN_SIDmyMSApp.CadInputQueue.SendKeyin "gdi import storage=iskn feature=jino_hranice_kp_pol level=""Hranice z RN_POLYGONY_KU"" color=4 weight=0 style=0"
Specified table (jino_hranice_kp_pol) contains polygons - with or without hole(s) (gtype=2003,elem_type=1003), multipolygons - with or without hole(s) (gtype=2007, elem_type=1003) and the discussed compound polygons (gtype=2003,elem_type=1005).
Import is successfull, but all of the compound geometries are omited without providing any error message.
All geometries in the table are valid (based on the sdo_geom.validate_geometry_with_context), table is registered in user_sdo_geom_metadata, has spatial index, primary key, everything...
MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1005,3,1,2,1,203,2,2,207,2,1), MDSYS.SDO_ORDINATE_ARRAY(-741245.35,-1043118.49,-741238.33,-1043100.16, ............))
I am using Oracle 11g (version 11.1.0.7.0).
Any clue, what am I doing wrong or any other idea how to achieve importing compound polygons from VBA?
Thank you for any kind of help,
Jiri Novak,
CUZK
Could this be because you have more than one sdo_gtype defined in the table ?
I don´t think so - I prepared a test table, where there were geometries of just one sdo_gtype = 2003 and with the spatial index with parameter 'layer_gtype=polygon' defined and it did not solve the problem. Still the compound polygons continues to be skipped :(
Thank you, the problem was exactly where you pointed - I had to change "copy local" to false. Now I succeded building your dll. Nevertheless when I open the Microstation Macro and want to add the reference to "Bentley.Geospatial.Extensions.Oracle.dll" it fails with "Microstation Visual Basic: can't add a reference to the specified file". Do you think this can be caused by compiling in VS C# Express 2010?
Jiri
...select the Bentley.Geospatial.Extensions.Oracle.tlb type library when setting your reference.
Regards,
Jeff Bielefeld [Bentley]
Great, it was really a Visual Studio version issue, compiling with VS 2005 succeded without any error. I managed to set the reference into VBA Microstation's macro and I wrote a simple test sub:
Sub Test()
Dim oOracleInstance As New OracleSpatialExtensions
oOracleInstance.connectAdhoc "publ", "publ", "publ"
'oOracleInstance.queryClass "PUBL_JINO_HRANICE_KP_OBVODOVE", "KP_KOD=101"
oOracleInstance.queryClass "PUBL_JINO_HRANICE_KP_OBVODOVE", "KP_KOD=101"
End Sub
I am connected without any problem, but querrying a table do nothing, I was inspecting the code in c# and "query all" should be by default.
Therefore the only problem could be in feature class. I do have in oracle table called "jino_hranice_kp_obvodove" in schema "publ" which has a collumn called "kp_kod", what then have I wrong in the function call?
Thank you very much for your help,
When I tried to work in a schema previously defined in BGA everything worked. So i have to have something badly in the class name while using ad hoc connection... I have no idea what :(
I can do it that way (prepare a XFM scheme for tables to be imported in advance), but the problem is that I am executing microstation from VB Script (command line) via COM interface (I am exporting data to approx 110 design files) and I don't know how to tell it the newly created instance should use user asociated to XFM scheme...
I am using something like:
Set myMSAppCon = CreateObject("MicroStationDGN.ApplicationObjectConnector")
Set myMSApp = myMSAppCon.Application
myMSApp.Visible = True
Set DesignFile = myMSApp.OpenDesignFile(vectorizedFileV8, False)
Is there any way how to achieve it?
Thank you very much,
...you could try to set the _USTN_USERNAME environment variable to the name of the user workspace (e.g. SET _USTN_USERNAME=geo_example_designer) in the shell before starting your session.
Jiri,
For you adhoc connection (e.g. without a schema) code, you will need to add the following highlighted lines to the connectAdhoc method:
public void connectAdhoc(string userName, string password, string serviceName) { GDI.GDIExplorerOracleImportsNode oracleNode = GDI.GDIExplorerAddIn.Instance.OracleNode; if (oracleNode != null && oracleNode.CountSubNodes() == 0) { ECSTORAGE.IECStorage storage = GDI.GeoDataInterchangeAddIn.Instance.OpenOracleStorage(userName, userName, password, serviceName, false); if (storage != null) { GDI.GDIExplorerOracleNode node = new GDI.GDIExplorerOracleNode("Current Session"); node.AddStorage(userName + "@" + serviceName, storage, false, null); oracleNode.AddSubNode(node); if (GDI.GeoDataInterchangeAddIn.Instance.MasterFileImport == null) GDI.GeoDataInterchangeAddIn.Instance.MasterFileImport = node;
} } }