4

Specifically, I have an empty File GeoDatabase template consisting of several Group Layers, each containing several Feature Classes. In fact each FC has several subtypes exposed by including a .lyr file in ArcMap. I want to extract the basic polygon geometry data from a dgn, and insert this geometry for each feature into one of the FCs in my FGDB.

This is what I have got so far:

I can import dgn data using arcpy.CADToGeodatabase_conversion(), but this only creates a new CAD dataset in the FGDB alongside my group layers. In ArcMap, by opening the attribute table on the Polygon FC in the new CAD dataset, I can see the fields I want (Shape, Shape_Length, Shape_Area), and I SUPPOSE I need to apply SearchCursor() and InsertCursor() to copy each geometry object to the correct FC in the FGDB. How would the code look to do this?

Is there a slicker way to read dgn geometry objects into an existing FGDB feature class?

1
  • 1
    I've been doing something similar this past week - created a model to iterate over the dgn files, select what I wanted and appended the features into the correct feature class within the gdb depending on file name. As PolyGeo mentioned, seeing as the coordinate systems were the same, I was able to append directly from the selection on my dgn into the correct feature class. Commented Jan 27, 2013 at 10:22

1 Answer 1

1

Your "Group Layers" in the file geodatabase will be Feature Datasets because the former exist only within maps and layer files.

If you have the same coordinate system stored for both the Feature Datasets you designed and the one that came in from your DGN file then as long as their schema match you should be able to copy/paste Feature Classes from one Feature Dataset onto another.

To be "slicker" in your conversion you may want to look at the Data Interoperability extension which has FME under its hood.

3
  • I have a serious problem here, I found the Python function CADToGeodatabase() in ArcGIS Resource Centre, but it crashed out of ArcCatalog/ArcMap and PythonWin in Debug mode. How do I show my code here, new to this site - thanks Rob P @Arabella
    – Rob P
    Commented Jan 28, 2013 at 13:44
  • my code: import arcpy, csv from arcpy import env dgnfile = str(arcpy.GetParameterAsText(0)) outFeatureClass = str(arcpy.GetParameterAsText(1)) #the fc in my fgdb template to be populated by data read from the dgn i = 0 while outFeatureClass[i:i+4] <> ".gdb": i+=1 inFeatureClass = outFeatureClass[:i+4] CADdataset = "GD_Temp" refscale = "1000" arcpy.CADToGeodatabase_conversion(dgnfile,inFeatureClass,CADdataset,refscale) Rob P @Arabella
    – Rob P
    Commented Jan 28, 2013 at 13:53
  • To show your code more readably just update your question and use the Code button to preserve formatting.
    – PolyGeo
    Commented Jan 28, 2013 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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