I’m developing an ArcGIS 10.1 desktop map editing application using ArcEngine and ArcObjects. I’m using a PostgreSQL database. After a direct database connection (using a query layer), I displayed the map. My problem is, the identify tool doesn’t really identify the features and their attributes (= It doesn’t display the attribute values) Please, look the situation here, pictorially. Has any one encountered such a problem or has an idea about it? Please give me anything (as a hint) that you think would solve my problem.So much thanks.
Here is the code:
public void GetMapData()
{
workspace = GetWorkspace();
try
{
mapQuery = "select * from public.t_parcel";
sqlWS = (ISqlWorkspace) workspace;
queryDescription = sqlWS.GetQueryDescription(mapQuery);
string uniqueNameInTheWorkspace = "";
sqlWS.CheckDatasetName(mapQuery, queryDescription, out uniqueNameInTheWorkspace);
ITable queryClass = sqlWS.OpenQueryClass(uniqueNameInTheWorkspace, queryDescription);
var queryFClass = (IFeatureClass) queryClass;
parcelFeatureLayer.FeatureClass = queryFClass;
rgbColor = new RgbColor {Red = 229, Green = 229, Blue = 199};
simpleLineSymbol = new SimpleLineSymbol {Width = 2, Color = rgbColor};
simpleFillSymbol = new SimpleFillSymbol {Color = rgbColor, Outline = simpleLineSymbol};
pSimpleRenderer = new SimpleRenderer {Symbol = (ISymbol) simpleFillSymbol};
var geoFeatureLayer = (IGeoFeatureLayer) parcelFeatureLayer;
geoFeatureLayer.Renderer = (IFeatureRenderer) pSimpleRenderer;
// Add the layer to the map control
parcelFeatureLayer.Name = "Layer";
axMapControl1.AddLayer(parcelFeatureLayer);
axMapControl1.Extent = axMapControl1.FullExtent;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
public IWorkspace GetWorkspace()
{
// Create the connection properties.
IPropertySet connectionProps = new PropertySetClass();
connectionProps.SetProperty("serverinstance", "172.20.0.71,5432");
connectionProps.SetProperty("dbclient", "postgreSql");
connectionProps.SetProperty("database", "geojson");
connectionProps.SetProperty("authentication_mode", "DBMS");
connectionProps.SetProperty("user", "postgres");
connectionProps.SetProperty("password", "123456");
// Create the workspace factory.
Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SqlWorkspaceFactory");
var workspaceFactory = (IWorkspaceFactory) Activator.CreateInstance(factoryType);
try
{
workspace = workspaceFactory.Open(connectionProps, 0);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
return workspace;
}