I got an Add-In that retrive data from an Oracle database and create a feature Layer in ArcGIS Pro, but after updating to ArcGIS Pro 3.5.2, that features are not drawing on the map.
But its only features that have a z-value from Oracle.
The code, where the feature layer are created look like this:
if (featureClass != null && featureClass.GetCount() > 0)
{
var def = featureClass.GetDefinition();
SpatialReference sr = def.GetSpatialReference();
GeometryType geomType = def.GetShapeType();
string oidField = def.GetObjectIDField();
var featureCreateParams = new FeatureLayerCreationParams(featureClass)
{
Name = this.tableName,
IsVisible = true,
};
FeatureLayer flyr = LayerFactory.Instance.CreateLayer<FeatureLayer>(featureCreateParams, map);
}
If I force the data to be 2D (In my SQL), the features are drawn on the map.
I can't figure this out. I need the z-value.
For the new layer, if you access the layer properties, what setting do you see under Elevation? Perhaps change this setting to see if your points are visible.
Hi Uma, the settings are set to 'absoulute height'.
I have tried to change the settings, but the feature layer are not drawn.
The add-in is doing the following:
1. User select a theme (like road, buidling ect.) and an extent (map extent, municipality level, country level)
2. The add-in makes a SQL and retrive data from Oracle
3. Show the feature layer in the TOC and the map.
The taget version are 3.1 and works fine (also in 3.2, 3.3)
Its only data with a z-value, that are not drawn.
If I manual creats a query layer, and past in a SQL (whit a z-value), ArcGIS Pro have no issues drawing the data on the map.
The SQL can ba a simpel 'Select * from {table} or more complex depening on the users input.
This is the code that open the table:
Map map = MapView.Active.Map;
CIMSqlQueryDataConnection sqldc = new CIMSqlQueryDataConnection()
{
WorkspaceConnectionString = oracleDatabase.GetConnectionString(),
GeometryType = this.geomType,
OIDFields = "OBJECTID",
Srid = "25832",
SqlQuery = this.GetQuery,
Dataset = this.tableName
};
QueryDescription queryDescription = oracleDatabase.GetQueryDescription(this.GetQuery, this.tableName);
FeatureClass featureClass = oracleDatabase.OpenTable(queryDescription) as FeatureClass;
I am not able to repro this one. My code looks like this:
Map map = MapView.Active.Map;
Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri(@"C:\Users\uma\Path\Oracle-gdb.sde")));
CIMSqlQueryDataConnection sqldc = new CIMSqlQueryDataConnection()
{
WorkspaceConnectionString = geodatabase.GetConnectionString(),
GeometryType = esriGeometryType.esriGeometryPoint,
OIDFields = "OBJECTID,NAME,NUMBER_",
Srid = "25832",
SqlQuery = "select * from MAP.TestPoints",
Dataset = "MAP.%pointsLayer"
};
FeatureLayerCreationParams featureLayerParams = new FeatureLayerCreationParams(sqldc)
{
IsVisible = true,
Name = "pointsLayerSDK"
};
FeatureLayer featureLayer = LayerFactory.Instance.CreateLayer<FeatureLayer>(featureLayerParams, map) as FeatureLayer;
Hi Uma, I used you code, but I did not have any luck drawing to data to the map, when I used an Oracle database. I tried with a postgresql database, and it worked.
var map = MapView.Active?.Map;
/*
var geodatabase = new Geodatabase(
new DatabaseConnectionFile(
new Uri(@"C:\Users\nan\Documents\ArcGIS\Projects\gv_tp\PostgreSQL.sde")));
*/
var geodatabase = new Geodatabase(
new DatabaseConnectionFile(
new Uri(@"F:\Users\nan\con\oracle.sde")));
var sqlQueryDataConnection = new CIMSqlQueryDataConnection
{
WorkspaceConnectionString = geodatabase.GetConnectionString(),
GeometryType = esriGeometryType.esriGeometryPolygon,
OIDFields = "objectid",
Srid = "25832",
//SqlQuery = "SELECT * FROM i.buildings", // from postgresql
SqlQuery = "select * from i.building", // from oracle
Dataset = "test"
};
var featureLayerCreationParams = new FeatureLayerCreationParams(sqlQueryDataConnection)
{
IsVisible = true,
Name = "PolygonLayerSDK",
};
var featureLayer = LayerFactory.Instance.CreateLayer<FeatureLayer>(
featureLayerCreationParams, map);
I did not have this problem, when I used the Add-in in ArcGIS Pro 3.2 - 3.4. I am using Oracle 19c.