Topobase

Reply
Active Member
hallgrimur
Posts: 9
Registered: ‎06-15-2010
Message 1 of 11 (2,514 Views)

Import data into Topobase

2514 Views, 10 Replies
09-17-2010 07:23 AM

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

Active Contributor
deetersmith
Posts: 41
Registered: ‎09-18-2007
Message 2 of 11 (2,375 Views)

Re: Import data into Topobase

12-21-2010 06:10 AM in reply to: 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

Active Member
hallgrimur
Posts: 9
Registered: ‎06-15-2010
Message 3 of 11 (2,358 Views)

Re: Import data into Topobase

12-23-2010 01:07 AM in reply to: hallgrimur

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

Active Contributor
deetersmith
Posts: 41
Registered: ‎09-18-2007
Message 4 of 11 (2,355 Views)

Re: Import data into Topobase

12-23-2010 05:05 AM in reply to: hallgrimur

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

Contributor
Shatohin
Posts: 16
Registered: ‎06-19-2009
Message 5 of 11 (2,341 Views)

Re: Import data into Topobase

12-24-2010 12:27 AM in reply to: hallgrimur

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

 

Contributor
Shatohin
Posts: 16
Registered: ‎06-19-2009
Message 6 of 11 (2,340 Views)

Re: Import data into Topobase

12-24-2010 12:35 AM in reply to: hallgrimur

 


 

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

Contributor
Sale05
Posts: 18
Registered: ‎04-28-2009
Message 7 of 11 (2,123 Views)

Re: Import data into Topobase

02-21-2011 02:31 AM in reply to: hallgrimur

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.

Active Member
hallgrimur
Posts: 9
Registered: ‎06-15-2010
Message 8 of 11 (2,072 Views)

Re: Import data into Topobase

03-01-2011 02:19 AM in reply to: Sale05

"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

Contributor
Sale05
Posts: 18
Registered: ‎04-28-2009
Message 9 of 11 (2,068 Views)

Re: Import data into Topobase

03-01-2011 02:37 AM in reply to: 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);

 

 

 

 

Contributor
Sale05
Posts: 18
Registered: ‎04-28-2009
Message 10 of 11 (2,066 Views)

Re: Import data into Topobase

03-01-2011 02:41 AM in reply to: Sale05

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.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!