Select to view content in your preferred language

Import attributes from Table into Feature Class

1287
3
05-04-2012 10:44 AM
ModernElectric
Frequent Contributor
I have been trying different things dealing with attributes from a table and bringing them into a feature class to make those attributes "native" to the feature class/objects.
This is what I currently have:
     I have a File Geodatabase (MEWCo_Water_Model.gdb) with a Feature Class called wMeters. Basically its minimal data that just shows the location of a meter. Other pieces of data is maintained and updated in our CIS system in a      completely different location. I have already developed a Python Script to import a table from the CIS system through an ODBC connection and make it a File Geodatabase Table. This happens every night.

     Currently - I have a relationship class build btwn the wMeters Feature Class and the CIS Table. The only think that this is helpful is to link the two things together. I have also gone through and did a Table to FC Join. This is nice
     because I can still change my symbols based on the attributes joined from the table.
         HOWEVER: Since we use ArcReader for our Crews and Operations staff - the joins do not work....So I lose that Table Joined to FC feature, which does me no good.

SO: This is what I want to be able to do:
    On a nightly basis - I want to have a Python script Import the CIS Data into my File Geodatabase (Python is already done). From there - I want to be able to take specific attribute fields from that table and import them into the
    Feature Class so they will become apart of the feature class.

What I have tried:
    I put together a Model (that would later be exported to a Python Script) to:
        Add Join (which after it exported to a new feature class) it changed ALL the field name. Since ArcDesktop 10 does not give us the ability to Rename a field - I had to Add Field, Calculate Field, Delete Field so I could have it
       set-up the way I wanted it.
            PROBLEM: When I did the Copy Features (to make a new feature class) it screwed by ObjectID Field up - which in returns screws my Attachments feature. That ObjectID needs to remain unchanged.

Need coffee yet??????

So, I know there is a much easier way to do this that I am just not seeing. If you understand what I am trying to accomplish - please help me out.

Thanks
0 Kudos
3 Replies
CarstenVock
Emerging Contributor
Hello,

I have exactly the same thing to do, can you post the methods you have used in your script? I would love to take a look at this and see if I finally have to get in touch with Python.

Thank you!
0 Kudos
JoeBorgione
MVP Emeritus
Since ArcDesktop 10 does not give us the ability to Rename a field - I had to Add Field, Calculate Field, Delete Field so I could have it  set-up the way I wanted it.
           
PROBLEM: When I did the Copy Features (to make a new feature class) it screwed by ObjectID Field up - which in returns screws my Attachments feature. That ObjectID needs to remain unchanged.



Not sure I can solve your problem, but I might be able to shed some light on the subject...

Not being able to rename a field is not new to v10.  It's been that way as long as I can remember (v4.5).  Adding a new field is the tried and true method.

The objectIds are not screwed up; when you create a new feature class and copy into it, the objectIds are generated for the new feature class.  ObjectIds should be avoided as join items because of this.  What I do is add a field and call it something like....  Joinitem and calc it to equal the objectId.  That way you know you won't have any repeats.

The trick is in automating the increment (joinitem +1 from the last feature/table record). 

Hope this helps-
That should just about do it....
0 Kudos
SusanO
by
Deactivated User
I don't know if it will help, but the ability to rename geodatabase fields is a new feature in ArcGIS 10.1, scheduled to release in a couple of weeks.
0 Kudos