Geographic Information Systems Asked by hana hana on June 10, 2021
I want to display my geodata stored in ArcGIS Server.
I did the connection to the server but the problem is the parameter versionName
. I will not use ArcSDE so I have ignored versionName
.
Can someone help me to find the solution?
ESRI.ArcGIS.GISClient.IAGSServerObject so = GetSelectedServerProxy();
ESRI.ArcGIS.GeoDatabaseDistributed.IGeoDataServer gdso = (ESRI.ArcGIS.GeoDatabaseDistributed.IGeoDataServer)so;
//++ Queries for subfields if the Get Fields checkbox is enabled
ESRI.ArcGIS.Geodatabase.IQueryFilter qf = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
qf.WhereClause = "";
//++ based on the start index and count entered.
ESRI.ArcGIS.Geodatabase.IResultPortionInfo range = new ESRI.ArcGIS.Geodatabase.ResultPortionInfoClass();
range.StartIndex = 0;
range.Count = 500;
//++ Run a tablesearch based on the version, table name, fields selected, startindex and count
ESRI.ArcGIS.GeoDatabaseDistributed.IGDSQueryResultPortion res = gdso.TableSearch(versionName,"tabl", qf, range);
According to the documentation you don't need to specify the version name on non-ArcSDE data: "If the geodatabase referenced by the GeoDataServer is an ArcSDE geodatabase, then you can set the versionName parameter to the version on which to execute the query. If no versionName is provided, the version that the GeoDataServer is currently referencing is used. For non-ArcSDE geodatabases, the versionName is ignored." See: IGeoDataServer.TableSearch Method
Answered by MathiasWestin on June 10, 2021
The code below works for me with a geodataservice based on a file gdb.
private static void ListFields(string svcName)
{
var conn = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection();
conn.Host = "localhost";
conn.Connect();
var ctx = conn.ServerObjectManager.CreateServerContext(svcName, "GeoDataServer");
var gds = ctx.ServerObject as IGeoDataServer;
var bo = ctx.CreateObject("esriGeodatabase.DEBrowseOptions") as IDEBrowseOptions;
bo.ExpandType = esriDEExpandType.esriDEExpandDescendants;
bo.RetrieveFullProperties = true;
var elements = gds.get_DataElements(bo);
for (int i = 0; i < elements.Count; i++)
{
var de = elements.get_Element(i);
var deTable = de as IDETable;
if (deTable != null)
{
Console.WriteLine("{0}", de.Name);
for (int j = 0; j < deTable.Fields.FieldCount; j++)
Console.WriteLine("t{0}",deTable.Fields.get_Field(j).Name);
}
}
ctx.ReleaseContext();
}
Answered by Kirk Kuykendall on June 10, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP