What is the most efficient (best) way to uniquely identify a feature on a arcMap

839
4
03-13-2014 01:46 PM
RickeyTom
New Contributor II
I need to store a reference to a selected feature that a user selects on the arcDesktop.

At first, we proceeded this the assumption that the layerClassID and the featureOID uniquely identifies a feature on an ArcMap setup.

It turns out that layer classID are unique only to the datasource (e.g., gdb).
The same classid can be used in multiple data sources.
This is clearly showin in the MillersRanch.mxd sample.
9 is streets in Pulbic_works.gdb and Lakes in Planning.gdb.


So it seems that I many have to store a some unique identifiere for the datasource.
What is that identifier.

Do I have to store the name of the database (Public_works.gdb).
what is the API to get at this in general, lets say the data is in SQLServer?


Basically, what is the best way to uniquely (Globally) identify a feature on a map for all sources of data.


Thanks
0 Kudos
4 Replies
NeilClemmons
Regular Contributor III
What's the purpose of this identifier?  If you just want the feature to have a unique id then assign it a GUID.  If you need to somehow be able to go back and find the feature using only this identifier then you need to come up with a convention for building the id that gives you all the information you need to locate the database, feature class and feature.
0 Kudos
RickeyTom
New Contributor II
After further googling, I found that layers are unique to a geo database.
And that features are unique to a layer.

So I guess the real question is, how to uniquely identify a layer in an arcMap.

Can someone confirm that storing the

database name, feature_layer_classid and feature oi

is the minimum required.

thanks
0 Kudos
RickeyTom
New Contributor II
What's the purpose of this identifier?  If you just want the feature to have a unique id then assign it a GUID.  If you need to somehow be able to go back and find the feature using only this identifier then you need to come up with a convention for building the id that gives you all the information you need to locate the database, feature class and feature.


We are providing an integration into a customer with an ESRI setup.
We cannot modify their environment. We have to store a reference to a feature in our database.
The challenge is how to get the UNIQUE id of a feature. A guid would have been nice if that is available on every feature in every setup.

Can we guarantee that this exists?
If so, what field is this?

Thanks
0 Kudos
NeilClemmons
Regular Contributor III
Assigning a GUID to each feature would require you to change the database schema, which you said you can't do.  Since that's not an option you'll have to figure it out based on the situation you're in.  To get back to the feature, you would need to store information about the database it comes from along with which feature class it belongs to and the OID of that feature within the feature class.  The OIDs are unique within the feature class and the feature class is unique within the database.  The problem is that database names are not unique.  You could have any number of personal geodatabases on a machine all with the same name just located in different directories.  The path to each would be unique, but only on that machine.  So, if it's possible to have databases on different machines with the same name then you would also need to store the machine name.  Maybe your environment is simple enough that you don't need to worry about all possibilities and only storing the database name is sufficient.  Perhaps you're only concerned with features from layers in a specific map document.  You might then only need to store the layer name from the document (and perhaps the document name) and the feature OID.  This, of course, assumes layer names will be unique within the document.  As you can see, every answer includes "it depends".  This isn't something that anyone can really help you with as you're the only one who knows the environment you're working in.
0 Kudos