Select to view content in your preferred language

Update ObjectID Field

7630
9
01-13-2014 04:39 AM
HaythamAbdel-Rahman
Deactivated User
I'm using ArcGIS 10.1 and I've a scenario where I want to do some changes in the feature class like (change projection, extract some features with specific criteria) and I want to maintain the objectID.

I'm thinking to save the current objectid and return it back after finishing my modification. but i don't know how to do it? any ideas?
0 Kudos
9 Replies
LeoDonahue
Deactivated User
Don't do that.

Object IDs are subject to change during edit sessions.
0 Kudos
TimWitt
Deactivated User
Why not add a field global ID to your features?
0 Kudos
HaythamAbdel-Rahman
Deactivated User
All, Thanks for the quick replies.

@timw1984 : I need to keep the OID as other systems are using them, I can't change them.

@ldonahue : I am not using edit sessions, I need to extract some data, and the re-project them.
0 Kudos
LeoDonahue
Deactivated User
And your select statement needs to get a specific set of ObjectIDs?
0 Kudos
HaythamAbdel-Rahman
Deactivated User
And your select statement needs to get a specific set of ObjectIDs?


No, I just need to save current OIDs in a new field, do whatever I want with the features, and then retrieve the OIDs back.
0 Kudos
VinceAngelo
Esri Esteemed Contributor
You really should not use ArcGIS registered rowid column values for anything, much less as
foreign keys into other tables.  If you change an objectid value, you have corrupted your
geodatabase instance -- please do not do this.

I recommend you find a different procedure for making the changes you need to make.
You can copy the relevant subset with a SQL query that changes the column name, register
that table, do whatever is necessary, copy the result back, then delete the intermediary
feature class.  This will not invalidate the rest of your instance, and is probably more likely
to work.

- V
0 Kudos
HaythamAbdel-Rahman
Deactivated User
You really should not use ArcGIS registered rowid column values for anything, much less as
foreign keys into other tables.  If you change an objectid value, you have corrupted your
geodatabase instance -- please do not do this.

I recommend you find a different procedure for making the changes you need to make.
You can copy the relevant subset with a SQL query that changes the column name, register
that table, do whatever is necessary, copy the result back, then delete the intermediary
feature class.  This will not invalidate the rest of your instance, and is probably more likely
to work.

- V


Let me share my problem to get you in, I have FC falls in two zones projection, and I need to reproject it to another system. which means I need to split it into two FCs, each has fallen in one zone, Reproject, and then merge them back again into one FC.

My issue is that there is another system linked to this FC by OID, and if the OID changed it will fail, and updating the OID in the other system is a very expensive operation, so my only way is to do my task with keeping the OID, how can I do that ?
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Assuming that you mean that features have been loaded with an incorrect coordinate reference, so that they are improperly placed in a current feature class, I would: 1) Add a new integer column 2) Populate the column with the rowid *only* for rows in the wrong location 3) Export only rows where the rowid is not NULL into a shapefile 4) Alter the shapefile's projection 5) Reproject the shapefile 6) Load the shapefile to a temporary feature class 7) Update the geometry column in the original feature class using the temporary geometry's foreign key 😎 Verify corectness 9) Populate the new column with rowid for all rows 10) Export the feature class to file geodatabase 11) Delete both feature classes 12) Load the FGDB feature class back into the enterprise geodatabase. Now you have a table with a user-managed primary key. -V
0 Kudos
HaythamAbdel-Rahman
Deactivated User
First: sorry for the late reply as I had another task to finish.
Second: let me describe my problem in detailed..

I have a dataset consists of more than 50 Feature class, all of them are projected into (Proj1) system.
The features inside every FC are located in 3 regions, My task is to reproject the features based on their regions, i.e. every region has its own transformation parameters to be projected to (Proj2) system.
For every feature class, I need to split it into 3 feature classes based on its region, and then project each one of them separately by custom transformation parameters to (Proj2) system.
So at the end I should have for every feature class in (Proj1) system, 3 resulted feature classes projected into (Proj2) system.
Now I should merge them back again into 1 feature class projected into (Proj2) system.
All that is not a big deal, except this constraint: I have to maintain the OID!! as there are other systems that are linked with these FCs via the OID.

This means simply I want for every Fc to (Split, Project, Merge) the features with maintaining the OID.
This is my problem in detail, hope its clear.
--
My first thought of it is to try to edit in the OId after finishing the projection and merging. however I think its not doable at all!

Now am thinking of another way, to do the following:
1-Loop on the features in the FC and project their geometry and store their new location.
2- modify the projection of the FC to be (Proj2) directly.

This should be a long operation (as I have about 3 million feature), however it will do the task with maintaining the OID.

So what do you think ?
0 Kudos