Geographic Information Systems Asked by megabytes on September 28, 2021
I’ve been teaching myself ESRI ArcObjects in C# over the past few weeks, I’m still very new in the ArcObjects world.
All of our data is in an Enterprise geodatabase on a MS SQL Server database.
I’ve been able to open the SDEWorkspace, iterate through said workspace datasets and eventually come to the feature class. I get the IFeatureCursor, iterate through that, find the IFeature object that I want to query via comparing the OID and then cast its IGeomertry Shape to IPoint, IArea whatever it is and pullout coodinants and fiddle with them.
I do have this problem where users will create new objects throughout that day but they will be inaccessable until they post and the database is compressed.
I know how the versioning all works on a database level, but I don’t know how to get that latest data out of the geodatabse before a post.
I can however find the SHAPE value ID within the version tables of the database, is there a fast way to just jump to a IGeometry Shape class if I know the Shape ID thats listened from within the database table.
For example I have a point feature class that has a SHAPE number of 9291884. Can I go straight to that somehow?
Alternatively, I can see the ‘image’ binary data stored in the points column in the database table, can I read that in and just cast it to an IPoint? Is that possible?
Thanks @Michael Stimson, youre right the IVersionedWorkspace was the way to go. Here is the ending up code that I've run with.
IVersionedWorkspace3 versionedWorkspace = (IVersionedWorkspace3)workspace;
IEnumVersionInfo enumVersionInfo = versionedWorkspace.Versions;
enumVersionInfo.Reset();
IVersionInfo versionInfo = enumVersionInfo.Next();
while (versionInfo != null)
{
string versionName = versionInfo.VersionName;
cbxVersion.Add(versionName);
Console.WriteLine("Version: " + versionName);
if (versionName == "UserVersionName")
{
Console.WriteLine("Found correct workspace");
_versionFW = (IFeatureWorkspace)versionedWorkspace.FindVersion(versionName);
break;
}
versionInfo = enumVersionInfo.Next();
}
IEnumDataset datasets = workspace.get_Datasets(esriDatasetType.esriDTFeatureDataset);
IDataset dataset = null;
while ((dataset = datasets.Next()) != null)
{
IFeatureClass featureClass = _versionFW.OpenFeatureClass(datasets.Name);
...
...
}
}
Answered by megabytes on September 28, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP