Hi
What would be the best way to import GIS data into Topobase from fileformats like SDF, SHP or DWG. The data is both Geometry and other object data connected to the geometry.
with regads
Hallgrimur
If you are importing into a specific module (gas,water,electric) using the oracle data module I would recommend having an oracle dba working with you or an Autodesk Consultant. If you are using the Autodesk Map3D capabilities all of the files can be used native. Use the Task pane data manager data connection tools. If you are going to SQL Spatial there was a great class at AU this year that explains the process very well. The class can be found on the AU website and was taught by Adam Johnason. I hope that you can get a better answer than this yet you are headed in the correct direction by the answer.
If you need anyother ideas please let me know
Hi
Thanks for the reply. It seem that this (I would think) simple job of getting data into Topobase is not so easy. I have been in contact with Autodesk but gotten limited answers. Getting data into Topobase through AutoCAD Map 3D is not working so well for various reasons. One is that the GEOM data that Map creates is not the same as Topobase is using. Also I am not getting the Map data transfer to create automatic FID when importing to Topobase.
The only way that I have been able to use is the ACCLASSIFY tool but that is only working for the 2009 version of the software so that is also quite limiting.
With regards
HallgrĆmur
The geometry may seem different because Oracle uses a different code than Autocad Map 3D. Ceck to see if the code in Topobase actually represents the original in Map3D. This could be what is creating the problem.
deeter
Hi
Its a really simple job with a standard Map functionality. You should add 2 data connections (sdf/shp and Oracle) and then import from one of them to another via Bulk copy.
Be sure that you import to Oracle connection (Topobase connection is read-only).
Alexander Shatohin
Getting data into Topobase through AutoCAD Map 3D is not working so well for various reasons. One is that the GEOM data that Map creates is not the same as Topobase is using. Also I am not getting the Map data transfer to create automatic FID when importing to Topobase.
Can you post the error messages you got?
GEOM is the Oracle standard data type. TB and Map could not store data in this format in different ways.
Alexander Shatohin
Actually there are some problems with bulkcopy import. There so no way to bulkcopy SDF and SHP into Topobase when jobs are enabled. You must copy data in other workspace where there are no jobs and insert data through PL/SQL. Another way to do is to create table in workspace user name in oracle and then bulkcopy to this table. This would be much simpler but when bulkcopy inserts data in non-Topobase Oracle table creates geom with MDSYS.SDO_GEOMETRY(3003... instead MDSYS.SDO_GEOMETRY(2003... and then you cannot copy this data to Topobase table. At least I don't know how to change this 3D SDO_GEOMETRY to 2D when bulkcopy is used. Also for this data when connected through Oracle I get point, line and polygone represenation.
"This would be much simpler but when bulkcopy inserts data in non-Topobase Oracle table creates geom with MDSYS.SDO_GEOMETRY(3003... instead MDSYS.SDO_GEOMETRY(2003... and then you cannot copy this data to Topobase table. At least I don't know how to change this 3D SDO_GEOMETRY to 2D when bulkcopy is used"
Excacly the problem I was seeing.
Hallgrimur
Actually we solved it. Here is Oracle function which converts 3D to 2D.
create or replace function to_2d (geom mdsys.sdo_geometry) return mdsys.sdo_geometry is geom_2d mdsys.sdo_geometry; dim_count integer; -- number of dimensions in layer gtype integer; -- geometry type (single digit) n_points integer; -- number of points in ordinates array n_ordinates integer; -- number of ordinates i integer; j integer; k integer; offset integer; begin -- If the input geometry is null, just return null if geom is null then return (null); end if; -- Get the number of dimensions from the gtype if length (geom.sdo_gtype) = 4 then dim_count := substr (geom.sdo_gtype, 1, 1); gtype := substr (geom.sdo_gtype, 4, 1); else -- Indicate failure raise_application_error (-20000, 'Unable to determine dimensionality from gtype'); end if; if dim_count = 2 then -- Nothing to do, geometry is already 2D return (geom); end if; -- Construct and prepare the output geometry geom_2d := mdsys.sdo_geometry ( 2000+gtype, geom.sdo_srid, geom.sdo_point, mdsys.sdo_elem_info_array (), mdsys.sdo_ordinate_array() ); -- Process the point structure if geom_2d.sdo_point is not null then geom_2D.sdo_point.z := null; end if; -- Process the ordinates array -- Prepare the size of the output array n_points := geom.sdo_ordinates.count / dim_count; n_ordinates := n_points * 2; geom_2d.sdo_ordinates.extend(n_ordinates); -- Copy the ordinates array j := geom.sdo_ordinates.first; -- index into input elem_info array k := 1; -- index into output ordinate array for i in 1..n_points loop geom_2d.sdo_ordinates (k) := geom.sdo_ordinates (j); -- copy X geom_2d.sdo_ordinates (k+1) := geom.sdo_ordinates (j+1); -- copy Y j := j + dim_count; k := k + 2; end loop; -- Process the element info array -- Copy the input array into the output array geom_2d.sdo_elem_info := geom.sdo_elem_info; -- Adjust the offsets i := geom_2d.sdo_elem_info.first; while i < geom_2d.sdo_elem_info.last loop offset := geom_2d.sdo_elem_info(i); geom_2d.sdo_elem_info(i) := (offset-1)/dim_count*2+1; i := i + 3; end loop; return geom_2d; end;
Insert the funkction in DB and later call it:
UPDATE table_name SET geom = TO_2D(geom);
Only thing which I am not sure, why bulkcopy even creates 3D. Only reasonable explaination would be that .shp or .sdf files were created (exported) as 3D.
Anyway this is not a problem anymore.