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 :(
2Martin: I don't think it is a GDAL thing - I was checking it on a Linux machine with GDAL1.7.2 by importing the same geometries to Grass and no problem occured...
2Jerry: Well, I would be happier if there was a solution in VBA, because I don't have experience with Microstation's port to .Net, but if you would be so glad and provide me a short example, it would be great. Nevertheless, do you think, this approach would not result finally in using the same library for import which didn't work me from VBA?
Thanks a lot for clarifying,
Jiri
I did an investigation on GDAL and found several things - it implements strictly OGC Simple Features design, therefore any arc is automatically translated into LINESTRING and there does not exist such a thing as polygon with both linear and circular segments :( Ogr2ogr generates a V7 DGN file for me, doesn't skip any geometry, but implicitly converts every arc into linestring feature. Because what am I writing requires automatization and preserving arc geometries i am still lack of solution... Anybody please have an idea?
Jiri,
For the following compound geometry...
SHAPE(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)--------------------------------------------------------------------------------------------------------------------------------------------SDO_GEOMETRY(2003, 32145, NULL, SDO_ELEM_INFO_ARRAY(1, 1005, 2, 1, 2, 1, 5, 2, 2), SDO_ORDINATE_ARRAY(6, 10, 10, 1, 14, 10, 10, 14, 6, 10))
...use of the "Oracle Spatial" node in the Interoperability application can produce the following...
...feature instance which preserves the arc. For reference GDAL/OGR is not used for geometry retrieval when using registered schema or ad-hoc "Oracle Spatial" connections.
Attached also is a simple example C# and VBA application...
...which demonstrates how to develop a COM enabled .NET assembly which can be used by VBA to create an "Oracle Spatial" connection and demonstrates feature lock, edit and post functionalities.
Regards,
Jeff Bielefeld [Bentley]
Thank you a lot Jeff!
I am newbie to C# and I encountered a problem while trying to build your project - I corrected all of the references to point to my microstation and map dlls, but it still complains me about:
Error 1 Unexpected error creating debug information file 'Z:\projekty\os2dgn\xfm_oracle1\xfmOracleExtensions\xfmOracleExtensions\xfmOracleExtensions\obj\Release\Bentley.Geospatial.Extensions.Oracle.PDB' -- 'Z:\projekty\os2dgn\xfm_oracle1\xfmOracleExtensions\xfmOracleExtensions\xfmOracleExtensions\obj\Release\Bentley.Geospatial.Extensions.Oracle.pdb: System could not find the specified file.
' Oracle Spatial Extensions
What am I missing? Or am I using incompatible version of .Net? I have Visual C# 2010 Express .Net Framework 4 Client Profile. Microstation 08.11.07.171 and Map 08.11.07.87
Telling the truth, I don't need a gui interface, I would be perfectly satisfied with a simple program that would just import data from specified Oracle Special table into my opened DGN and which execution I could just simply start from VBA...
Sorry, the Framework I am using while attempting to compile, is ".Net Framework 4"
...not familiar with that particular error, but at this time I would recommend the use of Visual Studio 2005 Edition when developing applications for the Bentley Map V8i (SELECTseries 1) platform. Also when adding/replacing references to accomodate your local installation, be sure and set the "Copy Local" property to "False".
The provided VBA user interface is intended for testing purposes. Your VBA application can connect to Oracle Spatial and perform queries w/o ever showing a user interface if you desire.
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?
...select the Bentley.Geospatial.Extensions.Oracle.tlb type library when setting your reference.
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,